PDA

View Full Version : Again! VC++ 6.0 Linking Error for OpenGL



like_gobeawan
03-08-2003, 09:22 AM
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! http://www.opengl.org/discussion_boards/ubb/frown.gif
anyone can help me ? thx a lot!

03-08-2003, 10:00 AM
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.

like_gobeawan
03-08-2003, 10:05 AM
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!

shinpaughp
03-08-2003, 11:16 AM
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).]

like_gobeawan
03-08-2003, 07:08 PM
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 http://www.opengl.org/discussion_boards/ubb/biggrin.gif 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 ^_^



Originally posted by shinpaughp:
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).]

shinpaughp
03-08-2003, 08:58 PM
You are very welcome. http://www.opengl.org/discussion_boards/ubb/smile.gif

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. http://www.opengl.org/discussion_boards/ubb/smile.gif

Patrick

like_gobeawan
03-08-2003, 10:09 PM
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:
You are very welcome. http://www.opengl.org/discussion_boards/ubb/smile.gif

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. http://www.opengl.org/discussion_boards/ubb/smile.gif

Patrick

shinpaughp
03-08-2003, 10:26 PM
Instead, you could #include "windows.h". But, as long as it works, it really doesn't matter.

like_gobeawan
03-08-2003, 10:28 PM
i tried "windows.h" but the output is blank window. thanks anyway ^_^


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

shinpaughp
03-08-2003, 11:51 PM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif
Patrick