VC++ 6 Linking woes

Before I explain my problem, I’d like to mention that I searched the forums, and while I came across a number of solutions that seemed like they should work, they didn’t.

Alright, I have been following the NeHe OpenGL tutorials. I hunted down all the outright errors, and my program COMPILES. However, building it will cause the linker to exclain proudly

Linking…
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glHint@8
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glDepthFunc@4
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glClearDepth@8
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glShadeModel@4
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glClear@4
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
Debug/opengl_tut_1.exe : fatal error LNK1120: 13 unresolved externals
Error executing link.exe.

NOW, I’d like to point out that following the advice of other threads, I went to project -> settings -> link and added glu32.lib, and glaux.lib. No dice. So I added for the hell of it glut32.lib (even though I don’t even use glut). Still nothing.

What have I missed here?

Have you included the most important library??

The openGL library “opengl32.lib”?

The other librarys are just utility library’s.

Originally posted by Volmarias:
[b]Before I explain my problem, I’d like to mention that I searched the forums, and while I came across a number of solutions that seemed like they should work, they didn’t.

Alright, I have been following the NeHe OpenGL tutorials. I hunted down all the outright errors, and my program COMPILES. However, building it will cause the linker to exclain proudly

Linking…
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glHint@8
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glDepthFunc@4
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glClearDepth@8
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glShadeModel@4
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__glClear@4
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
opengl_tut_1_correct.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
Debug/opengl_tut_1.exe : fatal error LNK1120: 13 unresolved externals
Error executing link.exe.

NOW, I’d like to point out that following the advice of other threads, I went to project -> settings -> link and added glu32.lib, and glaux.lib. No dice. So I added for the hell of it glut32.lib (even though I don’t even use glut). Still nothing.

What have I missed here?[/b]

Add the following lines at the top of your code:

#pragma comment (lib, “opengl32”)
#pragma comment (lib, “glu32”)
#pragma comment (lib, “glaux”)

  • Halcyon

Many thanks, its too bad that I didn’t run across a tutorial on setting up VC++ 6 before coding first.

Well, most tutorials tell you to link your libraries somewhere in there. But the thing is they don’t tell you how all the time. You could go in and include them through project settings or do the pragma line. I prefer the pragma line because it just looks cool and the code will compile on any VC version without any project settings having to be altered. But man…it still look sooo cool!

  • Halcyon