Unneeded console window when running a Racket Windows executable

204 views
Skip to first unread message

Champignac

unread,
Nov 22, 2015, 11:04:35 AM11/22/15
to Racket Users
Hi,

I have created a small Windows application in Racket starting with:

#lang racket
(require racket/gui)
(define frame (new frame%
... etc

with a few controls.

I compile it in a distribution (to run on other machines) with DrRacket menu "Racket / Create executable".

The application runs fine showing the expected frame when I double-click on its executable.

However there is always a secondary window, a console window, popping up at the same time. I want to get rid of this console window.

Any way to do that?

Markus Schmitt

unread,
Nov 22, 2015, 4:55:12 PM11/22/15
to Racket Users
> I want to get rid of this console window.
In the "Create executable" dialog select "GRacket" as Base instead of "Racket". That way no console window pops up when you run the executable.

Champignac

unread,
Nov 22, 2015, 5:41:58 PM11/22/15
to Racket Users
On Sunday, 22 November 2015 16:55:12 UTC-5, Markus Schmitt wrote:
> > I want to get rid of this console window.

> In the "Create executable" dialog select "GRacket" as Base instead of "Racket". That way no console window pops up when you run the executable.

I tried again as you suggest but this time I got the GRacket console instead.

Then I had an idea, I put all my program inside a single function like:

(define (main)
(all other functions))

(main) ; and call the main function

And it works! No more console.

But... I wonder if there is a simpler way then wrapping the whole program inside a function like this?

Getting closer! :)

Robby Findler

unread,
Nov 22, 2015, 6:16:23 PM11/22/15
to Champignac, Racket Users
Possibly you were printing something out? If you have expressions that
produce non-void results at the top of a "#lang racket" program, they
will print out, which can trigger creation of the console window.

Robby
> --
> You received this message because you are subscribed to the Google Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Champignac

unread,
Nov 22, 2015, 6:36:26 PM11/22/15
to Racket Users, picad...@gmail.com
On Sunday, 22 November 2015 18:16:23 UTC-5, Robby Findler wrote:
> Possibly you were printing something out? If you have expressions that
> produce non-void results at the top of a "#lang racket" program, they
> will print out, which can trigger creation of the console window.
>
> Robby

You got it right!

I was writing few controls like this:
(new menu-item% ...

which output (object:menu-item% ...) that triggers the console.

Writing this instead:
(define menu-a (new menu-item% ...

cures the problem even if 'menu-a' is never used.

Thanks!

Champignac

unread,
Nov 22, 2015, 7:30:31 PM11/22/15
to Racket Users, picad...@gmail.com

UPDATE:

In the end, I found out I could simply write:

(void (new menu-item% ...


Reply all
Reply to author
Forward
0 new messages