Great! I really appreciate the help. I also did not know about -dumpspecs, so that was also very useful. Thanks! -----Original Message----- >From: Brian Dessent <brian@xxxxxxxxxxx> >Sent: Feb 4, 2006 6:17 PM >To: Barry Andrews <titanandrews@xxxxxxxxxxxxx> >Cc: gcc-help@xxxxxxxxxxx >Subject: Re: Why does command prompt appear on Windows when starting a GUI app? > >Barry Andrews wrote: > >> I have a GUI application that is compiled with gcj on Windows. When I double click the .exe file in Windows Explorer, a command window comes up behind the GUI. Is there any way to get rid of this? Any help is much appreciated! > >On win32, when linking a binary there is a field called "subsystem" >which determines the kind of binary. This is documented on MSDN: ><http://msdn.microsoft.com/library/en-us/vccore/html/_core_.2f.subsystem.asp> > >Just about all normal apps will fall into the "console" or "windows" >categories, and the only real difference between the two is that a >console is created for the application by default for the former, >whereas the application must allocate the console itself (if if even >needs one) in the latter. > >Thus you just need to provide "--subsystem windows" to the linker to set >this field. If you are using a compiler driver to link (as you should >be) instead of calling ld directly then you'll probably have to specify >this as "-Wl,--subsystem,windows". The specs file for your compiler may >have defined "-mwindows" as a shortcut for this; you can check using the >-dumpspecs flag. > >It has been my observation that a lot of people seem to think that >"-mwindows" is somehow necessary for creating a windows binary, or that >if they use "-mconsole" they cannot have a GUI. This is simply not true >at all -- all this flag does is tell the linker to set the subsystem >field in the binary to a value which tells the system whether to >allocate a console by default. It says nothing about whether the >application can create graphical windows or anything else. But it is >true that often times if an application does have a GUI then it's not >desirable to have that console window created, so -mwindows sees a lot >of use in those apps. > >Brian