View Full Version: getting openGL to work...

C++ Learning Community > C++ for Linux > getting openGL to work...


Title: getting openGL to work...
Description: ...in ubuntu


IllegalEnzyme - September 27, 2005 08:14 AM (GMT)
hi, guys sorry i havn't been around for a while i've been kinda busy with a new job.

i've been trying to compile an openGL example in ubuntu 5.04, the code compiles fine, but for some reason it won't link to -lGL

here's the line from my makefile:

CODE
g++ main.o -lGL -lSDL -o demo


and the error i get:

QUOTE
error: -lGL does not exist


i've got the nvidia drivers installed for my graphics card, and i do have a copy of the shared libGL.so.1

can anyone tell me what i need to do to get this working?

thanx guys.

C-Man - September 27, 2005 10:00 AM (GMT)
check if you have libGL.a

myork - September 27, 2005 01:48 PM (GMT)
1) Does libGL.so live in /usr/lib?

If not add
CODE
-L<dir>


2) If you dont have a libGL.so then you need to add a soft link.

CODE
cd <dir>
ln -s libGL.so.1 libGL.so


PS. You could add your soft link in the /usr/lib directory thus stopping you from needing the -L<dir> flag.

CODE
ln -s <fullPath>/libGL.so.1 /usr/lib/libGL.so.1
cd /usr/lib
ln -s libGL.so.1 libGL.so


NB. If libGL.so.1 can not be found at runtime then your executable will not start. There are a couple of ways to make sure it is found correctly:

1) Put libGL.so.1 into /usr/lib or /lib
2) Set the environment variable LD_LIBRARY_PATH
3) Set the RPATH parameter inside your executable.


[URL=
http://list-archive.xemacs.org/xemacs-beta...1/msg00328.html]LD_LIBRARY_PATH and RPATH[/URL]




Hosted for free by InvisionFree