Advertisement

Linker Errors

Started by September 28, 2002 12:58 PM
3 comments, last by The Hidden 22 years, 5 months ago
I must admit that these tutorials are the best on the whole web if you want to program OpenGL. But: Sometimes I get a Linker Error: Unresolved External in...... And the problem is, this ain''t the first tut with this problem. To be exact: Every OpenGL Tutorial I ever made failed at some point due to a Linker Error... The funny thing is: Even if I simply COPY&PASTE the code from the tut and watch for misspellings, the linker error will appear. So, is there any Update, Headers or Dlls that I need to have to stop these Errors? I am using BCB 5.0 and I also tried it on VC++ 6.0 ... didn''t help... Thx
What exactly are the unresolved externals?
Chances are, you forgot to link to the OpenGL libraries - opengl32.lib, and perhaps glu32.lib.
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
Advertisement
Well that is VERY possible because I never really heard how to do this..

Thanks at this point... I am too tired to write a new program and compile it with the libs right now, but I will surely reply tomorrow how it worked..

PS: I am wondering how stupid one lonely guy can be *hittingmyselfonthehead* I always thought the libs were included automatically by pasting them into the Libs-Folder..
What''s unresolved external ?

Simply with a example :

2 files :

main.cpp

file.cpp

In you declare in the main.cpp this variable :

int Nbr;

And if you want to use this variable in the file.cpp you must declare the variable like this :

extern int Nbr;


If you don''t put the "extern", you''ll have the "Unresolved External" error.

========================
Leyder Dylan
http://ibelgique.ifrance.com/Slug-Production/
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/
The Hidden: This can make life a bit easier as it''ll make your projects build properly without having to go Project/Settings/Link and typing in the names of the libraries you want to link with.

Instead, use the following at the start of your code:

#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glu32.lib")
#pragma comment(lib, "glaux.lib")

This is a compiler directive, and tells the compiler to tell the linker to include those libraries in the build even if they''re not explicity mentioned in the project settings.

Note that I''m talking VC++ here - don''t know if there''s an equivalent in BCB. Still, hope that helps...

www.coldcity.com
code, pics, life
[size="2"]www.coldcity.com code, art, life

This topic is closed to new replies.

Advertisement