Eliminate shell window?

nobody wrote on Saturday, May 28, 2005:

Hi, I’m using mingw to compile my glfw programs and I have a problem. I get both my GLFW/OpenGL window, and a DOS window when I run the program. I know there must be a way to get rid of the DOS window but I don’t know how. Can anyone help me out?

melekor wrote on Saturday, May 28, 2005:

To remove the console window, you have to link your program as a win32 application, not a console one. This means you’ll need to use WinMain() instead of main() and change some compiler option. If you’re using VC++, It’s under project properties->linker->system->subsystem.

nobody wrote on Wednesday, June 01, 2005:

Darn. I really wanted to make my program portable. My first priority is making it run on both windows and Linux while only needing to compile it once. Is there a solution that will fix this problem for both Windows and Linux? Thanks for the help.

epsilondelta wrote on Wednesday, June 01, 2005:

Actually, you shouldn’t have to use “WinMain.” You can use “main” in windows programs, you just don’t have the benefit of accessing the native windows messaging system and structure if you go that route (which you don’t need in glfw anyway).

And you can remove the console window with most compiler systems that I know of. You just have to provide the correct switch to the linker, I believe. In the case of Mingw, I think you use "-mwindows" during the linker step. See the MinGW FAQ at the www.mingw.org site.


nobody wrote on Tuesday, August 09, 2005:

That’s easy, just goto Project options->Linker->advanced and set the EntryPoint field to mainCRTStartup

nobody wrote on Saturday, September 10, 2005:

Along with mainCRTStartup, /system:console needs to be replaced with /system:windows