cubuntugccopengl

cannont find lGL


Question: why can't it find -lGL?


Info: I wrote a program as guided by this site on my netbook this morning and it compiled and ran with no problem. I then proceeded to take the exact same code and try to run it on my desktop. the version my netbook compiled worked, but it yelled at me because my netbook doesn't have a graphics card and my desktop does so it wasn't quite compiled right. still ran though.

But when I tried to compile it on my desktop it failed. at first it was saying "Fatal error: GL/gl.h: no such file or directory" so i thought "wait, i thought opengl came with ubuntu, I mean my netbook worked, maybe I installed something and forgot about it" so i ran through apt and pulled down everything opengl I felt might help. but staring at 212 - 1278 packages (depending on what words i search with) that may or may not be opengl related, I don't know what else to try. I got past the first problem, but now it is complaining that it can't find -lGL, which seems really odd.

any tips, tricks, comments, quips? My end objective is to be able to compile c code from the command line, I've been using the command that I got from the afore mentioned site:

gcc -o gltest gltest.c -lX11 -lGL -lGLU

I run Ubuntu 11.04 desktop, 64-bit. Nvidia GTX465.


Solution

  • Your compiler was looking for a lib called libGL.so in /usr/lib, which was a symbolic link to /usr/lib/mesa/libGL.so, Mesa's libGL. You also have the libGL from your nVidia drivers (which are probably in 275.28 version, see the libGL name : libGL.so.275.28). Modifying the symlink to point to nVidia's one gives your compiler no longer the Mesa's one, but the nVidia's one.