Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: newbie question

  1. #1
    Guest

    newbie question

    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.

  2. #2
    Member Regular Contributor
    Join Date
    Sep 2000
    Location
    Vancouver BC Canada
    Posts
    418

    Re: newbie question

    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.

  3. #3
    Guest

    Re: newbie question

    <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>

  4. #4
    Member Regular Contributor
    Join Date
    Sep 2000
    Location
    Vancouver BC Canada
    Posts
    418

    Re: newbie question

    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

  5. #5
    Guest

    Re: newbie question

    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

  6. #6
    Member Regular Contributor
    Join Date
    Sep 2000
    Location
    Vancouver BC Canada
    Posts
    418

    Re: newbie question

    Strange.

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

    Code :
     -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?

  7. #7
    Guest

    Re: newbie question

    thanks alot for your help

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

    thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •