Archived

This topic is now archived and is closed to further replies.

gmonkey

gcc and Mesa3D

Recommended Posts

i can''t get a simple opengl prog to compile under linux. this is with Mesa3D installed, GLUT in place, samples compiled just fine and run so i know it''s set up more or less properly. if i compile with gcc cube.c -o cube -lglut -lGLU -lGL it compiles with no errors but when i try to run the executable is says ./cube: error while loading shared libraries: libglut.so.3: cannot open shared object file: No such file or directory guess i''m not linking it right. i''ve done openGL programming before but never under redhat. what''s the proper way to compile the code?

Share this post


Link to post
Share on other sites
Well, if you''re getting to the point to where you can launch your application, then it''s beyond a linking problem. It sounds like you haven''t configured ld properly. LD_LIBRARY_PATH can be set to ''.'' to search the directory ./cube is in (assuming by "in place"). You should probably install glut properly in the future, either by a package (debian: apt-get install libglut3), or /usr/local/lib (you may need to update /etc/ld.so.conf and run ldconfig as root).

Share this post


Link to post
Share on other sites
if i specify -L then it gives me an error:

/usr/local/lib/libGL.so: undefined reference to `grBufferSwap''
collect2: ld returned 1 exit status

thing is all the demos run with no problems. i guess i''ll try to recompile some of them and see what options are used...

Share this post


Link to post
Share on other sites
solved my own problem. didn''t bother with the LD_LIBRARY_PATH variable. just specified -Xlinker -R/path/etc in the gcc command line. no more errors. well, not from linking anyway...

Share this post


Link to post
Share on other sites