program linking trouble in VC++

Hey,
I’ve been programming in OpenGL for a few weeks now and the most common problem I get is this weird link error. Sometimes it shows up… sometimes not. I usually just start adding libraries until it goes away but I’d really like to know what the hell is going on? Has anyone seen this error or know what it is?

[b]
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/keyboard_movement.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.[/b]

you have created a win32 app, which expects the entry point WinMain
you have provided code for a win32 console app, which uses the entry point main(). Just create a new project as a console application and your code should work fine

127 hits in the archive

you can open up GL in either the win32 api interface or console based depending on your code.also make sure you are linking the libary files for application. opengl32.lib glu32.lib glaux.lib must be part of your linker tables…

So, if you build a counsel app, it’s main(), but if you build a win32 app it’s got to be winmain()? I thought that was only if your specifically using the win32 api? Doesn’t glut (oh, I’m using glut btw) provide some kind of translation for this?

The entry point is determined by the parameters you pass to the linker. By default, a Win32 Console app tells the linker that there is going to be an entry point named “main()”, and a Win32 Application tells the linker there is going to be an entry point named “WinMain().” So, either start the project with the correct wizard, or look into the linker settings after you start the project.

Ahhh! That was it. Thanks so much. I just changed the entry point in the linker settings.

-=GB=-