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 -

John

Visit http://nehe.gamedev.net 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…

-John

Read around “console” here, it is not the same MSVC version, but should help :
http://www.lighthouse3d.com/opengl/glut/

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”” )
#endif

The relevant linker options are documented at:

http://msdn.microsoft.com/en-us/library/f9t8842e(VS.71).aspx
http://msdn.microsoft.com/en-us/library/fcc1zstk(VS.71).aspx

Thanks -

John