Keep in mind i’m new to OpenGL, so be soft on the responses;
I’m currently using the MingW compiler for my projects, although it might not be of any relevance to my problem- I receive an “undefined reference to glPerspective@32” error whenever trying to compile a project using the glPerspective() function,eg.
Any suggestions? Logical fixes?

You sure that is not supposed to be gluPerspective instead of glPerspective? Or is that just an error in your message?

Yepp, you forgot a ‘u’ in your call to gluPerspective. You also need to #include <GL/glu.h> and add glu32.lib to your project.

Actually, there is another problem (and I am surprised that you did not spot it out, Bob !).

You should use :

glMatrixMode(GL_MODELVIEW); // Not GL_PERSPECTIVE ! //

GL_MODELVIEW Huh? You sure you don’t mean GL_PROJECTION?

Projections is suppose to reside in the projection matrix, and translations in the modelview.

But look at the error message in the first post, the problem is the perspective function. But you are right, GL_PERSPECTIVE is wrong.

p.s. And I addmit, I didn’t noticed it… whistle

Arf’ yes, I meant GL_PROJECTION !

Sorry, Muerte, I do not want to confuse you…

So, the definitive code is :


1,2,3… Sold !

Best Regards.


P.S. : Thanks Bob !

Lol, yeah i’m sorry i made alot of dumb mistakes in that code which i posted originally. It wasn’t directly coppied and pasted from my source code, i typed it out again and had mistakes. The exact code is:
/some initialization stuff up here/
/*rest of stuff down here */

and this seems to generate the error which i stated in the original message. Again, sorry about the mistakes before, next time i’ll copy/paste directly for perfection.

Made another mistake and put GL_PROJECTION instead of GL_PERSPECTIVE, but that isn’t the problem causing the error.
Looks like you simply need to link in the glu library when building the executable.

[This message has been edited by DFrey (edited 10-05-2000).]

Thanks, DFrey, and is there a specific way I can link the library from within the source code?

Sorry, I don’t know how to do it with the MingW compiler (never heard of it till you mentioned it). But my guess would be to use the command line option -lglu32 to make it link in the glu32 library.

[This message has been edited by DFrey (edited 10-05-2000).]

But… in some way you must have managed to get the OpenGL library file into your project/commandline/makefile/whateveryoumightbeusing. Otherwise you should have gotten similar error messages for each call to the core OpenGL (those with ‘gl’ prefix). So I guess you should do about the same with the GLU library file too.

er… Bob- Lets just put it this way- i’ve included the 3 libraries “Gl.h”, “glaux.h”, and “glu.h” to my project. From the responses i’m getting, i’m quite sure this has something to do with the compiler i’m using now-MingWin. =

gl.h, glu.h and glut.h are not the libraries, they are just the header files. All these contain is prototype statements for the functions, the libraries contain the actual functions (or at least masks to them because the DLLs contain the actual functions). Your compiler will have one of two ways of doing this - either you will have a nice sofficticated compiler and you will have a project window where you can add all the source files and librarys your program needs. OR you need a make file which tells the compiler exactly what to do when in which case you need to add the command line (it was somewhere earlier on in the discussion) to the make file, to make sure that the library is added.

You probably need these 3 libraries:
OpenGLMemoryStub and
for glut you will also need glut.lib.

Failing that get a decent compiler like Visual C++, Borland C++ or Metrowerks Codewarrior.

Heh, ok i got it working now. Thanks to …drum roll… DFrey. All i needed was the glu32 library, everything else was already linked. Thanks to everyone else too, though.