[TriLUG] Gasp, OpenGL library problems!

Randall Barlow rpbarlow at eos.ncsu.edu
Fri Dec 9 00:01:26 EST 2005


Howdy all,

    I'm trying to learn how to code using GLUT, and so I wrote a simple 
little program, and after hours of Googling, I still can't get it to run 
(although I can get it to compile just fine!)  Here's the command I used 
to compile it:

 g++ -o opengltest opengltest.cpp -L/usr/lib/opengl/xorg-x11/lib/ -lglut 
-lGL -lGLU -lXmu -lXi -lXext -lX11 -lm -lstdc++

But when I try to run the executable I get the following error:

error while loading shared libraries: libGL.so.1: cannot open shared 
object file: No such file or directory

I included the folder /usr/lib/opengl/xorg-x11/lib/ specifically so the 
libGL could be linked properly, and I've even tried copying libGL.so.1 
to the local directory, but still no go.  Google isn't helping me right 
now (although I finally figured out that I had to add all the -l's!)  
Anyone know what to do?

Thanks,
Randy

P.S.  My short little program is included below:

//opengltest.cpp
#include <GL/glut.h>

void renderScene(void) {
    glClear(GL_COLOR_BUFFER_BIT);
        glVertex3f(-0.5,-0.5,0.0);
        glVertex3f(0.5,0.0,0.0);
        glVertex3f(0.0,0.5,0.0);
    glEnd();
    glFlush();
}

int main(int argc, char **argv) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
    glutInitWindowPosition(100,100);
    glutInitWindowSize(320,320);
    glutCreateWindow("3D Tech- GLUT Tutorial");
    glutDisplayFunc(renderScene);
    glutMainLoop();
    return 0;
}



More information about the TriLUG mailing list