Unresolved externals :(

Started by
7 comments, last by Tantalus 22 years, 4 months ago
I had it solved once... but I forgot what I did... lost the project that I fixed it with... so I don't know what to do.. I have everything I need included, and I linked glu32.lib, glaux and opengl32 .lib.... But I always get this error when building (compiles fine): Linking... LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main Debug/robot.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. no idea what is wrong... Edited by - Tantalus on December 9, 2001 11:45:15 AM
You are but a lowly hair on my scrotum.
Advertisement
When creating a project, be careful with what kind of project you choose. A "Win32 Application" uses WinMain for entry point, a "Win32 Console Application" uses main for entry point.

Your code probably has a WinMain, while you created a console application, which requires a main instead. Therefore the linker complains when it cannot find main.
isnt winmain called by main? you are probaly using sdl, i had that problem too! be sure your arguments of main are correct: main(i dont know what but it has to be correct);
"be fair! ... always"Zeusel
if u''re wanting to create a GL app that isn''t GLUT then you need to (as brother bob said) create a "win32 Application" otherwise it is a DOS application which needs main()
Neither work.
You are but a lowly hair on my scrotum.
When I do daily builds at work, and I get that error message, it usually means that I need to do a full rebuild, instead of the "changed-files only" build which is the default in VC++.

In Visual C++, go to Build->Rebuild All.

RomSteady - Able to leap off tall buildings in a single bound
Michael Russell / QA Manager, Ritual EntertainmentI used to play SimCity on a 1:1 scale.
nope...
You are but a lowly hair on my scrotum.
Dose you program have the function

main()

or

WinMain()

www.EberKain.comThere it is, Television, Look Listen Kneel Pray.
I'm not going to ask you what you did; rather, I'm going to tell you what you did and how to avoid such in the future.

You wrote your code as a proper Win32 app - WinMain and all. You probably hit compile and got that popup message about requiring a workspace, and you said yes. Mistake. Saying yes causes MSVC to create a Win32 console application rather than a Win32 application. It is possible to change from one to the other by modifying some settings, but I forget which. Easiest thing to do is to create a new project workspace and be sure to choose Win32 Application as its type. You can even add the new project workspace to the existing one, so you can build a console app to test specific little routines and a full-fledged Win32 app as your final product.

Taking a few extra minutes to ensure your environment is set up properly every time can be a huge help.

[edit:] Oops, forgot the smiley! People might actually think I'm serious!

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!

Edited by - Oluseyi on December 13, 2001 7:36:17 PM

This topic is closed to new replies.

Advertisement