问题:为什么不能找到-lGL?
信息:我今天上午在我的上网本上按照本网站的指导编写了一个程序,编译运行没有问题。 然后我继续使用完全相同的代码并尝试在我的桌面上运行它。 我的上网本编译的版本工作,但它对我大吼大叫,因为我的上网本没有显卡,而我的桌面也是如此,所以编辑得不是很好。 还是跑了。
但是当我尝试在桌面上编译它时失败了。 起初它说“致命错误:GL / gl.h:没有这样的文件或目录”所以我想“等等,我以为opengl带有ubuntu,我的意思是我的上网本工作,也许我安装了一些东西而忘了它”所以我跑过apt并取下了我认为可能有帮助的所有opengl。 但是盯着212 - 1278个包(取决于我搜索的单词)可能会或可能不会与opengl相关,我不知道还有什么可以尝试。 我遇到了第一个问题,但现在它抱怨它找不到-lGL,这似乎很奇怪。
任何提示,技巧,评论,讽刺? 我的最终目标是能够从命令行编译c代码,我一直在使用我从上述网站获得的命令:
gcc -o gltest gltest.c -lX11 -lGL -lGLU我运行Ubuntu 11.04桌面,64位。 Nvidia GTX465。
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 -lGLUI run Ubuntu 11.04 desktop, 64-bit. Nvidia GTX465.
最满意答案
你的编译器在/ usr / lib中寻找一个名为libGL.so的lib,它是/usr/lib/mesa/libGL.so,Mesa的libGL的符号链接。 您还有来自nVidia驱动程序的libGL(可能是275.28版本,请参阅libGL名称:libGL.so.275.28)。 修改符号链接指向nVidia的符号链接使编译器不再是Mesa的编译器,而是nVidia的编译器。
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.
更多推荐
发布评论