GLUT in Win32 application

I am trying to make glut work in win32 app (not console). In win32 app, i use the WinMain function instead of main. I use the standard WinMain function. My code is this:

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
// TODO: Place code here.
glutInit(0, NULL);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowPosition(200, 200);
glutCreateWindow(“Actual window”);


return 0;


the problem is that the app runs, but makes an error, and forces the user to close it. u know the window. U can try it too to tell me if it works, but please help me a bit. also, what is the argc and argv values? do the vary?

argv is a array that contents the command line parameters and argc is the number of parameters. You must use thsese parameters in gluInit to work.

You can use bogoParameters for example:
char** argvbogo;
int argcbogo;
instead the real parameters.

Hey, i deleted the glutInit function, and the program runs ok… ? is the glutInit useful only for console apps?