Problems compiling code from the OpenGL tutorials

Started by
29 comments, last by Twisol 18 years, 7 months ago
I'm using the compiler/IDE called Bloodshed Dev-C++, and am trying to compile code from the first 5 tutorial lessons. Dev-C++ comes with some OpenGL .h files, and I got the glaux.h from a DevPak. When I compile a file (say, the code from tutorial 1), I get tons of linker errors. The DevPak manager in Dev-C++ is supposed to put the files where they belong, so it can't be that. Any idea what's wrong? By the way, the errors look like this... In function Z13ReSizeGLSceneii: [Linker error] undefined reference to glViewpoint@16
Advertisement
Quote:Original post by linkofazeroth
I'm using the compiler/IDE called Bloodshed Dev-C++, and am trying to compile code from the first 5 tutorial lessons. Dev-C++ comes with some OpenGL .h files, and I got the glaux.h from a DevPak. When I compile a file (say, the code from tutorial 1), I get tons of linker errors. The DevPak manager in Dev-C++ is supposed to put the files where they belong, so it can't be that. Any idea what's wrong?

By the way, the errors look like this...
In function Z13ReSizeGLSceneii:
[Linker error] undefined reference to glViewpoint@16


You need to link to opengl (and maybe glu)

libOpengl32.a
libglu32.a

-lopengl32 -lglu32
So would I #include those files? It was working about 15 minutes ago (and I completed tutorial 5 when it stopped working)
Quote:Original post by linkofazeroth
So would I #include those files? It was working about 15 minutes ago (and I completed tutorial 5 when it stopped working)


No. You include header files, not code libraries. You need to LINK the files I listed. Look in your project options and add them to your linker commands. I stopped using devC++ a while ago, I forget the name of the menu option to select sorry. It may be compiler options, or project settings or build options. [sad]

I think it's compiler options. So which folder are the files I need to link to in?
Quote:Original post by linkofazeroth
I think it's compiler options. So which folder are the files I need to link to in?


They are in lib/gl but you can just type this I think

-lopengl32 -lglu32
There's no gl folder in lib. :(
Quote:Original post by linkofazeroth
There's no gl folder in lib. :(
Look in the mingw folder. DevC++ is not a compiler, it's an IDE. MingW is the compiler that comes with it, and it inclues OpenGL

Include OpenGL before GLU.
I didn't know that... huh. Well, mingw32/lib has to gl folder either. :( Only gl folders I see anywhere are in the include folder.
The lib files are in the lib folder under the name of libOpengl32.a for bloodshed but all you need to do is add "-lopengl32 -lglu32" to the linker options for your project

This topic is closed to new replies.

Advertisement