MSVC project setup for GLUT?

I’ve just started with MSVC++ (2008 Express), and I’m trying to run the SGI ‘hello’ example code from redbook/hello.c. This runs fine, except that I get two windows: the GLUT window, and the MS console window.

Any ideas on how I can set up my project so that I don’t get the console window? I’ve tried two project templates:

1 - win32/console app
2 - general/empty project

Thanks -


Visit and check tutorials. It is quite old stuff, but good for beginers.

Thanks, but I don’t think he uses GLUT - he starts with a Win32 application, so uses a Windows-specific setup. GLUT is easier and more portable, but I have to find a way to disable the redundant console…


Read around “console” here, it is not the same MSVC version, but should help :

Whoa! I was just about to say exactly the same thing but you beat me to it. In short, add this to your code:

#ifdef _MSC_VER
#pragma comment( linker, “/subsystem:"windows" /entry:"mainCRTStartup"” )

The relevant linker options are documented at:

Thanks -


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.