PDA

View Full Version : AHHH!!! HELP!! :confused:



ViRuS
11-13-2000, 02:14 PM
i downloaded the nehe's opengl tutorial 1 visual c++ code and it doesnt seem to want to compile. i am sure i linked everything as it asked but when it compiles, it says:

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

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


http://www.opengl.org/discussion_boards/ubb/confused.gif HELP!! whats goin on here???

Deiussum
11-14-2000, 04:18 AM
Heheh, you have the exact opposite problem of someone else here. The Nehe tutorials I've looked at don't use Glut, which typically uses a Win32 console application. You're apparently using the wgl functions and creating the window yourself so you'll need to start the project as a Win32 Application.

The linker is looking for a main() function as an entry point into your program and not finding it. What you want is for it to use WinMain() as the entry point instead and a Win32 Application project sets it up like that for you.

11-14-2000, 01:50 PM
The NeHe tuts are good, but I can't remember if tut 1 was complete or not... try one of the later ones, they're better, like 18 or 19 http://www.opengl.org/discussion_boards/ubb/smile.gif (Thanks go to the ppl who do the VB translations... I'm not the greatest C/OpenGL programmer!) Perhaps sub main is declared as void and u r returning something or it's an int and u rn't returning something, I don't know http://www.opengl.org/discussion_boards/ubb/smile.gif Do you have SP4 installed? Maybe it makes the difference. I got SP4 with my copy of Visual Studio 6.

Deiussum
11-14-2000, 02:36 PM
If that were the case he'd be getting compiler errors, not linker errors. http://www.opengl.org/discussion_boards/ubb/smile.gif

Punchey
11-16-2000, 08:13 AM
No, the first suggestion is correct. The application is configured as a console app so the linker is looking for main() as the insertion point. Switch it to a plain Win32 app and it'll work.