VC++ Compiler Problem!!!

I’m a beginner.I write a program:

#include <windows.h>
#include <GL\gl.h>
#include <GL\glaux.h>

int main(void)
{
auxInitDisplayMode(AUX_SINGLE|AUX_RGBA);
auxInitPosition(0,0,500,500);
auxInitWindow(“simple”);

glClearColor(0.0,0.0,0.0,0.0);
glClear(GL_COLOR_BUFFER_BIT);

glColor3f(1.0,0.0,0.0);
glRectf(-0.5,-0.5,0.5,0.5);

glFlush();
return 1;

}

When I compiler the program,passed!!But,when I run the program,error occured:

--------------------Configuration: simple - Win32 Debug--------------------
Linking…
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/simple.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

simple.exe - 2 error(s), 0 warning(s)

What I can do???

Hi !

You have told the linker to create a GUI application, and that is why it is looking for a WinMain function, if you want to create a console application (that is when you have a main() function) you need to tell the linker this, if you are using Visual Studio there is a settings for this in the linker properties, if you are using the linker from the console yoiu mus specify an option for this, don’t remember which one at the moment.

If you search on “WinMain” in this forum you will find more information.

Mikael

Thanks!
I have run this program successedly!
Method No.1:
Change the function main() to WinMain().
Method No.2:
To Build a Console Application.

Finally,Thanks to Mikael.