Again! VC++ 6.0 Linking Error for OpenGL

hi,

my opengl program compiles fine, but getting linking error like the following

=========================================
--------------------Configuration: hello - Win32 Debug--------------------
Compiling…
hello.c
Linking…
hello.obj : error LNK2001: unresolved external symbol _glFlush
hello.obj : error LNK2001: unresolved external symbol _glEnd
hello.obj : error LNK2001: unresolved external symbol _glVertex3f
hello.obj : error LNK2001: unresolved external symbol _glBegin
hello.obj : error LNK2001: unresolved external symbol _glColor3f
hello.obj : error LNK2001: unresolved external symbol _glClear
hello.obj : error LNK2001: unresolved external symbol _glOrtho
hello.obj : error LNK2001: unresolved external symbol _glLoadIdentity
hello.obj : error LNK2001: unresolved external symbol _glMatrixMode
hello.obj : error LNK2001: unresolved external symbol _glClearColor
hello.obj : error LNK2001: unresolved external symbol _glutMainLoop
hello.obj : error LNK2001: unresolved external symbol _glutDisplayFunc
hello.obj : error LNK2001: unresolved external symbol _glutInitWindowPosition
hello.obj : error LNK2001: unresolved external symbol _glutInitWindowSize
hello.obj : error LNK2001: unresolved external symbol _glutInitDisplayMode
hello.obj : error LNK2001: unresolved external symbol ___glutInitWithExit
hello.obj : error LNK2001: unresolved external symbol ___glutCreateWindowWithExit
Debug/hello.exe : fatal error LNK1120: 17 unresolved externals
Error executing link.exe.

hello.exe - 18 error(s), 0 warning(s)

eventhough i have set the project setting library linking with opengl32.lib, glut32.lib, and glu32.lib; then included glut.h and gl.h already in the program. i also tried the #pragma line in the code, but all didn’t work.
last time, it works fine on win98 platform, but now on win xp, it’s not!
anyone can help me ? thx a lot!

Hi!
I also have linking error with VC++ 6.0. I get a lot of bugs when I use more than one source file when on the other compilers every thing works fine. But your problem seems to be rather WinXP fault than VC.If you have included all libs and headers you shouldn’t have got those errors.

any clue what’s different on win xp ?
i searched through opengl forum about this vc 6++ linking error issue, but no one has the same problem on win xp like this… they seem to b able to solve using the library and project linking method.

thx!

Where do you have the opengl32.lib, glut32.lib and where do you have the opengl32.dll, glut32.dll located physically on your drives? What is the directory path? Also, for some reason the opengl32.lib included with VC6 and VC7 is much smaller than the opengl32.lib included with the download from the download page. It is only 76k included with VC and 300+k from the download. It may still work, but I remember having problems long ago until I downloaded it from OpenGL’s download page v1.1.

Make sure your gl DLLs are located in your windows system directory and your libs are in the VC98\lib directory.

Hope this helps in some way.

[This message has been edited by shinpaughp (edited 03-08-2003).]

Thanks a lot !! Now it works !
This is what i did :
i re-downloaded the glut package from opengl download page v1.1 as u said, and put them into their proper folder. doing this will remove the linking error yeah !! but generates other windows error during building process.

then in the program itself, i include 1 additional line at the beginning of the program,
#include <GL/glaux.h>
this enables me to display the output successfully.

thanks a lot… now can start learning opengl more :slight_smile:

Originally posted by shinpaughp:
[b]Where do you have the opengl32.lib, glut32.lib and where do you have the opengl32.dll, glut32.dll located physically on your drives? What is the directory path? Also, for some reason the opengl32.lib included with VC6 and VC7 is much smaller than the opengl32.lib included with the download from the download page. It is only 76k included with VC and 300+k from the download. It may still work, but I remember having problems long ago until I downloaded it from OpenGL’s download page v1.1.

Make sure your gl DLLs are located in your windows system directory and your libs are in the VC98\lib directory.

Hope this helps in some way.

[This message has been edited by shinpaughp (edited 03-08-2003).][/b]

You are very welcome.

I’m surprised it wouldn’t work without the glaux.h unless you are actually using some functions from it or you added the glaux.lib library even if you aren’t using it. If you aren’t using any glaux functions just remove the glaux.lib from either your #pragma statements or from project settings as well as the #include “glaux.h” and it should still work. Or you could leave it. Your choice.

Anyway, glad I could help.

Patrick

hi Patrick,

without #include <GL/glaux.h>, my program will give the following errors:

============
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1135) : error C2054: expected ‘(’ to follow ‘WINGDIAPI’

(about 100 more errors with the same kind of errors)

the same original program that can run on win98 last time doesn’t need #include <GL/glaux.h> at all. so i think it’s really needed for some reason, maybe because the window API is needed to complement the gl.h file.

Like.

Originally posted by shinpaughp:
[b]You are very welcome.

I’m surprised it wouldn’t work without the glaux.h unless you are actually using some functions from it or you added the glaux.lib library even if you aren’t using it. If you aren’t using any glaux functions just remove the glaux.lib from either your #pragma statements or from project settings as well as the #include “glaux.h” and it should still work. Or you could leave it. Your choice.

Anyway, glad I could help.

Patrick[/b]

Instead, you could #include “windows.h”. But, as long as it works, it really doesn’t matter.

i tried “windows.h” but the output is blank window. thanks anyway :slight_smile:

Originally posted by shinpaughp:
Instead, you could #include “windows.h”. But, as long as it works, it really doesn’t matter.

Sorry for all of that. I thought for sure that somehow you could have avoided including that file when you do not use any of the functions. Don’t worry about it. As long as it is working, that is all that matters. I’ll let you get back to enjoying OpenGL.

Enjoy
Patrick