Error lGL on SUSE

Hi, I am running SUSE 11.3, I recently installed all the packages of OpegGL using Yast.

When I try compiling a file, with this code:
gcc -o file file.cpp -lglut -lGL -lGLU
I read this error:
gcc: lGL No such file or directory.

This error don’t appear on other machines.
I’ve probably done something wrong in the installation.

can someone help me?

Thanks.

maybe gl is not installed in the default lib directory path, try to add -L /usr/X11R6/lib in your command line.
If still don’t work, try to check where gl libraries are installed and modify the -L in accordance.

You’re in luck. I’m sitting on an SuSE 11.3 box right now, with the NVidia OpenGL drivers installed, and I find:


> ls -l /usr/lib64/libGL.so* /usr/lib/libGL.so*
lrwxrwxrwx 1 root root     10 Oct 29 08:35 /usr/lib/libGL.so -> libGL.so.1
lrwxrwxrwx 1 root root     18 Oct 29 08:35 /usr/lib/libGL.so.1 -> libGL.so.260.19.14
-rwxr-xr-x 1 root root 757412 Oct 29 08:35 /usr/lib/libGL.so.260.19.14
lrwxrwxrwx 1 root root     10 Oct 29 08:35 /usr/lib64/libGL.so -> libGL.so.1
lrwxrwxrwx 1 root root     18 Oct 29 08:35 /usr/lib64/libGL.so.1 -> libGL.so.260.19.14
-rwxr-xr-x 1 root root 980368 Oct 29 08:35 /usr/lib64/libGL.so.260.19.14

/usr/lib64 is for 64-bit libs. /usr/lib is for 32-bit libs.

When you specify -lGL on the link line, that tells GCC to go searching the system library directories for a file named libGL.so. As you can see, it finds it in /usr/lib64 directory (for a 64-bit build). And that daisy chains to libGL.so.1 and onto libGL.so.260.19.14, which is the actual library file.

Also, if you don’t have a vendor-specific GL driver installed, looks like the “Mesa” package is what provides the libGL.so symlink:

> rpm -qf /usr/lib64/libGL.so
Mesa-7.8.2-1.3.x86_64

The dir. /usr/X11R6/lib is empty! :confused:

Oh Good!!I’m studying programming OpenGL on my Asus EEE

I tried this:


> ls -l /usr/lib64/libGL.so* /usr/lib/libGL.so*
ls: can not access /usr/lib64/libGL.so*: No such file or directory
lrwxrwxrwx 1 root root     10  8 ago 19:30 /usr/lib/libGL.so -> libGL.so.1
lrwxrwxrwx 1 root root     12  8 ago 19:29 /usr/lib/libGL.so.1 -> libGL.so.1.2
-rwxr-xr-x 1 root root 404624  5 lug 15:19 /usr/lib/libGL.so.1.2
> rpm -qf /usr/lib/libGL.so
Mesa-7.8.2-1.3.i586

Is it correct?

Thanks for reply.

Looks good. Now your original error was:


gcc -o file file.cpp -lglut -lGL -lGLU
I read this error:
gcc: lGL No such file or directory.

This error is not possible given the command you specified. So one or the other is wrong. “lGL No such file …” would imply that you put -llGL on the link line. It should be -lGL. -l being the option and GL being the base library name (libGL.so being the full name).

In fact the code i wrote was:


> gcc -o file file.cpp -lglut lGL -lGLU

without “-”!!

Sorry for the mistake!!! :smiley: :smiley:
Thanks for the reply!
Now everything works!!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.