PDA

View Full Version : Help Me!!



08-13-2002, 04:11 AM
I get the following error in vc++ 6 when linking and cannot continue, rebuilding (all) and cleaning does not help!!!!

Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Lesson1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

kevinhoque
08-13-2002, 04:25 AM
You seem to be using the wrong type of project. If you are using GLUT then (I think) that you need to have a Win32 console application. If you are not using GLUT then a Win32 application is the type of project that you need.

Good luck
Kevin

Latrans
08-13-2002, 04:53 AM
Of course doing a clean build didn't fix it. You created a console app, and you have NO MAIN FUNCTION!

Say it with me...

Win32 Console app = main() entry point
Win32 Application = WinMain() entry point

Any questions?

marcus256
08-13-2002, 05:39 AM
You can also force entry point (I prefer main(), since it's more portable than WinMain), regardless if you're building a Console or Windows app.

The command line flag for using main() is:

/entry:mainCRTStartup

There is probably a similar setting accessible from the IDE too.

Now you can use main() - always (for building GLUT Windows applications too)!

08-13-2002, 06:29 AM
The thing is, it is already a WinMain() function. Anyone got any other suggestions???

Mezz
08-13-2002, 07:04 AM
It may well be a WinMain() function - but is that in a project type of "Win32 console Application" or "Win32 Application"

The "console" part is important!

Look at what Latrans said!

-Mezz

08-13-2002, 07:19 AM
Stupid, Stupid, Stupid. (Bashes Head Against Desk)!!!

I started a new project (Win32 App), added a C++ source file, copied the code and presto. It worked.

Thanks!!!!