PDA

View Full Version : MSVC project setup for GLUT?



jdsimpson
12-09-2009, 05:17 AM
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

yooyo
12-09-2009, 05:46 AM
Visit http://nehe.gamedev.net and check tutorials. It is quite old stuff, but good for beginers.

jdsimpson
12-09-2009, 06:51 AM
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

ZbuffeR
12-09-2009, 07:06 AM
Read around "console" here, it is not the same MSVC version, but should help :
http://www.lighthouse3d.com/opengl/glut/

jdsimpson
12-09-2009, 07:17 AM
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%28VS.71%29.aspx
http://msdn.microsoft.com/en-us/library/fcc1zstk%28VS.71%29.aspx

Thanks -

John