c++configurationglutfreeglutglfw

Removing console window for Glut/FreeGlut/GLFW?


Under Visual C++, I have played around with Glut/FreeGlut/GLFW. It seems that everyone of these projects adds a CMD window by default. I tried removing it going under:

Properties->C/C++->Preprocessor->Preprocessor Definitions

From here, I remove the _CONSOLE and replace it with _WINDOWS

Then I went under:

Properties->Linker->System->SubSystem

And I set the option to Windows (/SUBSYSTEM:WINDOWS)

Then when I try compiling under GLFW, I get the following building errors:

Is it possible to remove the console window?


Solution

  • Non-console Windows applications use the WinMain() entry point convention. Your Glut examples probably use the standard C main() convention.

    If you want a quick fix just for the demo app, the WinAPI function FreeConsole() might help.

    MSDN: http://msdn.microsoft.com/en-us/library/ms683150(v=vs.85).aspx