Archived

This topic is now archived and is closed to further replies.

Linker Errors...

This topic is 5654 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m just doing a quick Windows app to demonstrate OpenGL, I have to following at the top of the file (it''s all one file): #define __Test_3D__ #include <windows.h> #include <gl/gl.h> #include <gl/glu.h> All the prog is so far is the WinMain() and a message procedure and all it should do so far is create a window with an empty OGL viewport. However, wherever I''ve used a gl/glu/wgl function, I get these messages from the linker: --------------------Configuration: Test 3D - Win32 Debug-------------------- Compiling... main.cpp Linking... main.obj : error LNK2001: unresolved external symbol _gluPerspective@32 main.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0 main.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4 main.obj : error LNK2001: unresolved external symbol __imp__glViewport@16 main.obj : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4 main.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8 main.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4 Debug/Test 3D.exe : fatal error LNK1120: 7 unresolved externals Error executing link.exe. Test 3D.exe - 8 error(s), 0 warning(s) This is only my second OGL program, the first one worked, as far as I can tell, it''s exactly the same in structure to my other program, yet it does not work... Can anyone help? I can provide the source if necessary. Cheers.

Share this post


Link to post
Share on other sites
You need to link the Open GL lib, and make sure you include windows.h too.

EDIT: oh, and the glu lib file needs to be linked too!

-J

[edited by - jason2jason on June 25, 2002 3:06:45 PM]

Share this post


Link to post
Share on other sites
Jason is right. You will need to link to libraries for each project you create. If you are using MSVC++, you can just:


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


That command will search for the proper libraries.

Share this post


Link to post
Share on other sites