PDA

View Full Version : newbie question



04-16-2001, 02:42 PM
im trying to compile

gcc ... -L/usr/X11R6/lib -lGL -lGLU -lglut

and i get errors like" undefined reference to glXQueryExtension" ect...

hmm i really dont know whats wrong. Any help would be appriciated.

rts
04-16-2001, 03:23 PM
Could you copy and paste the exact command line you use and the exact errors you get?

From what you posted it looks like you're doing everything OK.

04-16-2001, 03:38 PM
<code>
[root@knavely proj]# gcc hmm.c -L/usr/X11R6/lib -lGL -lGLU -lglut
/usr/X11R6/lib/libglut.so: undefined reference to `glXQueryExtension'
/usr/X11R6/lib/libglut.so: undefined reference to `glXMakeCurrent'
/usr/X11R6/lib/libglut.so: undefined reference to `glXQueryExtensionsString'/usr/X11R6/lib/libglut.so: undefined reference to `glXChooseVisual'
/usr/X11R6/lib/libglut.so: undefined reference to `glXDestroyContext'
/usr/X11R6/lib/libglut.so: undefined reference to `glXWaitX'
/usr/X11R6/lib/libglut.so: undefined reference to `glXQueryVersion'
/usr/X11R6/lib/libglut.so: undefined reference to `glXGetClientString'
/usr/X11R6/lib/libglut.so: undefined reference to `glXIsDirect'
/usr/X11R6/lib/libglut.so: undefined reference to `glXSwapBuffers'
/usr/X11R6/lib/libglut.so: undefined reference to `glXCreateContext'
/usr/X11R6/lib/libglut.so: undefined reference to `glXGetConfig'
collect2: ld returned 1 exit status
</code>

thats what happens when i compile heres the program.
<code>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <GL/glut.h>
#include <stdlib.h>


void display(void)

{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.75, 0.25, 0.0);
glVertex3f(0.75, 0.75, 0.0);
glVertex3f(0.25, 0.75, 0.0);
glEnd();
glFlush();

}

void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0,1.0,0.0,1.0,-1.0,1.0);
}

int main(int argc, char** argv)
{
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250,250);
glutInitWindowPosition(100,100);
glutCreateWindow("hello");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
</code>

rts
04-16-2001, 03:43 PM
That's pretty odd. What distro are you using?

You might try:

-lglut -lGLU -lGL

or

-lglut -lGLU -lGL -lX11

or

-lglut -lGLU -lGL -lXext -lX11


Let me know which one works http://www.opengl.org/discussion_boards/ubb/smile.gif

04-16-2001, 03:52 PM
using mandrake 7.2

in the first one i got different/more of the same errors
the second/third user/bin/ld "cannot find -lX11
and in the fourth " cannot find -lXext

rts
04-16-2001, 03:59 PM
Strange.

I also use Mandrake 7.2, and all I need is
the following:




-L/usr/X11R6/lib -lGL -lGLU -lglut


Couldn't find -lX11??? That's not good... it should be in /usr/X11R6/lib, which you specify on the command line.

Uhm... what do

$ rpm -q XFree86

and

$ rpm -q Mesa

tell you?

04-16-2001, 04:06 PM
thanks alot for your help http://www.opengl.org/discussion_boards/ubb/smile.gif

i got it working...i reinstalled xfree86-dev pkg and now iv got my hello box.

thanks again