Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unresolved External Symbols 2

Status
Not open for further replies.

forlorn

Programmer
Dec 12, 2001
28
TR
Hi, i'm working on a project that's supposed to draw 3D plots. So i have a header file that includes gl.h and glu.h which reside in vc98\include directory.

But i get link errors such as :
OpenGL.obj : error LNK2001: unresolved external symbol __imp__glEnable@4

And same error for the rest of the functions defined in gl.h and glu.h.

Do you have any ideas to overcome this problem?

Thanks in advance.
 
This error means that although the compiler finds the declaration for this function, the linker does not find its compiled definition. Since you get the .h from VC98\include, then you should find the corresponding library and add it to your project (I would try something like vc98\lib for files like gl.lib)

Vincent
 
add this line at the beggining of your program (or in stdafx.h)

#pragma comment(lib,"opengl32")

to include a reference to opengl32.lib

It should work now,

HTH s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
Thanks for the tip. Now it finds the implementations of functions defined in gl.h, but not the functions in glu.h

Do you know which library includes those functions? Or any idea where i should look to find it out?

Thanks again.
 
Hi

When you got a problem like this, you first have to check the library requirement of that function in the documentation.
Looking in glu.h, I checked for the function gluPickMatrix (I choose this at random).
In the documentation, it gives you the answer:
Import Library: Link with glu32.lib.

In the Workspace, Select 'Project | Settings'. Select the tab 'Link', and add 'glu32.lib' in the 'Object/Libray modules' edit control. You can also add the one require for Opengl.

Compile. It should work ....

HTH

Thierry
EMail: Thierry.Marneffe@swing.be
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top