Sign in to follow this  
Unknone

NeHe

Recommended Posts

Unknone    100
Hi all! I'm going throught the NeHe tutorials and whenever I download the code and move the *.cpp to another file and try to compile it, I get 16 link errors. Please help me someone.

Share this post


Link to post
Share on other sites
Daishim    244
I believe the documentation tells you the libraries you need to link, which is OpenGL32.lib, GLu32.lib, and GLAux.lib. However, I do know, there is code on the NeHe site to replace the GLAux code.

Share this post


Link to post
Share on other sites
Unknone    100
I'm not having any problems with that. What I'm having problems with is that I download it, and it works. I move the .cpp and make a new workspace for it and compile, and it dies on me. I think it's trying to make me destroy it... very frustrating....

Share this post


Link to post
Share on other sites
jbadams    25674
Quote:
Original post by Unknone
I'm not having any problems with that. What I'm having problems with is that I download it, and it works. I move the .cpp and make a new workspace for it and compile, and it dies on me.

Yep, that's what they've told you how to deal with, albeit in not much detail. The workspace has settings somewhere for which libraries need to be linked to the project so that it'll be able to compile. If you move the file into a new workspace, you'll have to set up that workspace with the correct linking options.

Lesson 1 tells you how to do it, although the options might differ slightly depending on what IDE you're using. Quoted from the lesson:
Quote:

After you have created a new Win32 Application (NOT a console application) in Visual C++, you will need to link the OpenGL libraries. In Visual C++ go to Project, Settings, and then click on the LINK tab. Under "Object/Library Modules" at the beginning of the line (before kernel32.lib) add OpenGL32.lib GLu32.lib and GLaux.lib. Once you've done this click on OK. You're now ready to write an OpenGL Windows program.

I believe those particular instructions are intended for Visual C++ 6, so if you're not using that and can't figure out where to find those options in your particular IDE, let us know which one it is and we'll see if we can help.

Share this post


Link to post
Share on other sites
Unknone    100
OK. Didn't see that bit. I did it and it got rid of all OpenGL related errors. Now there are only 2 left lol. *sigh* My luck....

All that is is left is:

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

I know what the second one is, but I have had the first in a few projects in past times and never got around to working it out. Can someone help me please?

Share this post


Link to post
Share on other sites
Daishim    244
It looks like you don't have a main() function. The main function is the entry point for the program-- ie WinMain() for a windows application and main() for a typical console program. Provided you're compiling the examples and haven't changed any of the source code, you may have created a console application workspace instead of a windows application workspace. Try creating the workspace as a windows application and try again.

PS. Don't forget to link the OpenGL libraries again.

Share this post


Link to post
Share on other sites
Unknone    100
Lol. I may be new to programming, but I'm not that stupid. Yes, it is a Win32 Application. I know that the error is asking for a main. But I don't know why, esspecially 'cus Main() is for console apps. I have a WinMain() Function.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
"...it is a Win32 Application"
A console applicaion is a *win32 applicaion* too...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
When creating your project make sure you have 'Win32 Application' rather than 'Win32 Console Project' selected.

Win32 application expects you to specify a WinMain
Win32 console project expects you to specify a main

Share this post


Link to post
Share on other sites
Unknone    100
Far out! I said I know what I'm doing. I've had the same error in a number of Win32 Applications. I'm not QUITE that stupid. Very close, but not quite ;) If it says "Win32 Application", I will create the project as a Win32 Application...

Thnx for the help.

Share this post


Link to post
Share on other sites
Unknone    100
Lol. It was going automatically to Console App when I compiled it. That was te one thing I didn't consider surprisingly. That's why I didn't give an answer before. I was embarrassed to say that what I had been 100% against before, was actually correct.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this