#pragma comment( linker, "/entry:\"mainCRTStartup\"" )

this pragma is supposed to kill the bl… command line window constantly popping up. At least Nate’s tutorial collection’s c-codes say so. However, the only benefit I get is a warning message:

Warning W8094 fog.c 19: Incorrect use of #pragma comment( <type> [,“string”] )

I admint that I almost never use another pragma besides #pragma comment(lib, “glut32.lib”), so can anyone help me with this?
Or does anyone know another way to get rid of the console window when using glut? Please?



#include <windows.h>
#include <GL/glut.h>

int main(void); //prototype main function
int APIENTRY WinMain(HINSTANCE hInstance, //let windows do its thing
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
main(); //give control to main function
return 0;



Thank you for your replies!
Umm, unfortunately, neither solution works… The pragmas in the faq produce the already mentioned warning and with the pseudo main function I get “earlier declaration of ‘main’”. Maybe this is because I use a the Borland compiler? Has anyone with the BCC32 5.5 solved this problem? 'Cause I dont want to switch to VC++ now…


This is a typically compiler-spcific thing. I do not use Borland (yet, but I downloaded the free compiler). The thing is that you normally need to force the entry point to main() if you do not want to use WinMain (which you should normall avoid -> not protable). Here is how it works on a few different compilers:

MinGW: (command line) -mwindows
Cygwin: (command line) -mwindows -e _mainCRTStartup
MSVC: (command line) /link /subsystem:windows /entry:mainCRTStartup
LCC-Win32: (command line) -subsystem windows

So basically, you need to find a way (either in the IDE or from the command line) to force the entry point (as you can see, MinGW and LCC-Win32 does not need this forced setting, they find main() anyway).

In some compilers you can use pragmas as you described, but personally I dislike this… Anyway, it’s a matter of personal taste.

Hmm, cool, at least the background is clarified to me now. You do not happen to have found out already how to set the entry point in Borland, do you? Anyway, I’m looking, and just in case I dont find something on this topic, I’ll use MinGW instead, now that I know how it’s done there…
Anyway, thanx!


Nope, haven’t found out yet, sorry.

In your search for compilers and such, go to this link: Getting Started

The Borland Compiler option to make a Win32 executable is -W
I have yet to find how to set the entry point…
Stay tuned.


Hey marcus256, have you any experience in building GLUT-programs with lcc-Win32? The glut32.lib does not seem to work, it gets several undefined references:

Or maybe anyone else using lcc?