Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • Error 1 error LNK2001: unresolved external symbol _WinMain@16 MSVCRT.lib

  • Error 2 fatal error LNK1120: 1 unresolved externals glfwWindow.exe

Is it possible to remove the console window?

like image 899
Johnathan Avatar asked May 13 '11 17:05

Johnathan


1 Answers

To get rid of the console using cmake, the link flags can be set as follows:

set_target_properties(exe_name PROPERTIES 
    LINK_FLAGS "/ENTRY:mainCRTStartup /SUBSYSTEM:WINDOWS")
like image 182
Chao Avatar answered Oct 11 '22 01:10

Chao