Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
OpenGL
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
JGonthier
n00b
n00b


Joined: 06 Feb 2005
Posts: 6

PostPosted: Sat Feb 12, 2005 10:51 pm    Post subject: OpenGL Reply with quote

Does anyone know the correct libraries to #include for compiling OpenGL programs? I have emerged opengl, glut, and glu. This is what my include statements look like.

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

When I try to compile using g++, I get messages that say "undefined reference to 'glutPostRedisplay' etc....
Back to top
View user's profile Send private message
bruda
Guru
Guru


Joined: 06 May 2004
Posts: 376
Location: Sherbrooke, QC, Canada

PostPosted: Sat Feb 12, 2005 11:07 pm    Post subject: Reply with quote

The header files you include in your source contain just the prototypes, the actual functions are in various libraries linked together with the program by the linker. You don't include libraries when you use the #include pre-processor directive.

In this particular case you want to link against (I think) the glut library using the -l flag. Something along the line
Code:
g++ <other options> -lglut -o <executable> <object1> <object2> ...

or if you compile and link in one step
Code:
g++ <other options> -lglut -o <executable> <C++ source>

I am not sure about the name of the library you need to use, this is the (only) library provided by the glut package so I am guessing it is the right one for your application.
_________________
Quid latine dictum sit altum videtur
Back to top
View user's profile Send private message
dakster
Apprentice
Apprentice


Joined: 26 Jul 2004
Posts: 178
Location: New England

PostPosted: Sun Feb 13, 2005 6:07 pm    Post subject: hmm Reply with quote

This is truly embarassign to admit, but I'm stuck on a winders box right now, so I can't double check this, but try linking against the gl utility library too, -lGLU, in addition to the glut one...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum