Advertisement

Linking Error...Please help

Started by May 20, 2001 10:29 PM
2 comments, last by Jackthemeangiant 23 years, 9 months ago
Hello, I have been writing all my GL programs in Delphi so far, and decided to write my next one in C++. I am using VS 6.0 Anyways, I set up a system class, and it compiles and build fine in debug mode, but when I build it as a realease I get a bunch of linking errors as follows: Linking... oglSystem.obj : error LNK2001: unresolved external symbol _gluPerspective@32 oglSystem.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0 oglSystem.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4 oglSystem.obj : error LNK2001: unresolved external symbol __imp__glViewport@16 oglSystem.obj : error LNK2001: unresolved external symbol __imp__glHint@8 oglSystem.obj : error LNK2001: unresolved external symbol __imp__glDepthFunc@4 oglSystem.obj : error LNK2001: unresolved external symbol __imp__glEnable@4 oglSystem.obj : error LNK2001: unresolved external symbol __imp__glClearDepth@8 oglSystem.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16 oglSystem.obj : error LNK2001: unresolved external symbol __imp__glShadeModel@4 oglSystem.obj : error LNK2001: unresolved external symbol __imp__glClear@4 oglSystem.obj : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4 oglSystem.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8 oglSystem.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4 Did I forget to add somthing in the settings?... Thanks for any help, Jack
Well....
it seems u forgot to add a few libs...
in the settings (under the link tab), add the libs:
opengl32.lib

and if u plan on using glu:
glu32.lib

that will get u going...

good luck.
Advertisement
I did add the libs.....


My program build fine when I build it as a debug, but the file is pretty large then. When I build it as a realease, is when i get those error.


Jack
Nevermind, I fixed it,

I just had to add this code at the top

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



Jack
Just so you know, what you probably did at first was add the libs just for the debug compile, and not for the release compile. Visual C++ defaults to debug mode, and when you go into the project settings, if you have just the debug build selected, any changes will only affect the debug compile, and not the release compile. The #pragma comment() will work as long as you use Visual C++, I don''t think that it works in other compilers.

J.W.

This topic is closed to new replies.

Advertisement