Unresolved Externals

I’m trying to get started in opengl, I tried compiling a simple program, but I get
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/gl.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Dunno whats going on. Help?

Odd, it’s usually the other way around. Are you using GLUT? If so, did you create your project (assuming you’re using MSVC) as a Win32 console application rather than a normal Win32 application?

WinMain is the entry point for an Win32 application. If you want to use standard c main as the entry point, do the following (under MSVC):

Go to the project settings, Linker-Tab, Output and enter “mainCRTStartup” as the entry point (type it in exactly with upper- and lowercase).

After this the standard main-function will be used as your applications starting point.

Hope this helps.

P.S.: I forgot to mention, taht you should start with a win application. That prevents Windows from generating a console window every time you run your application.

[This message has been edited by CoBour (edited 03-23-2001).]