简体   繁体   English

/usr/bin/ld: 找不到 -lGL (Ubuntu 14.04)

[英]/usr/bin/ld: cannot find -lGL (Ubuntu 14.04)

I'm trying to build a project created in QT Creator and unfortunately every time I try to compile I get an error.我正在尝试构建一个在 QT Creator 中创建的项目,不幸的是每次我尝试编译时都会出错。 Here is my compiler output:这是我的编译器输出:

23:02:20: Running steps for project WallpaperAppQt...
23:02:20: Configuration unchanged, skipping qmake step.
23:02:20: Starting: "/usr/bin/make" 
g++ -m64 -o WallpaperAppQt main.o mainwindow.o moc_mainwindow.o   -L/usr/X11R6/lib64 -lQt5Widgets -L/usr/lib/x86_64-linux-gnu -lQt5Gui -lQt5Core -lGL -lpthread 
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make: *** [WallpaperAppQt] Error 1
23:02:20: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project WallpaperAppQt (kit: Desktop)
When executing step 'Make'
23:02:20: Elapsed time: 00:00.

You need a package that provides the libGL.so (no version suffix) symlink. 您需要一个提供libGL.so (无版本后缀)符号链接的软件包。 In Ubuntu, it's in the libgl1-mesa-dev package. 在Ubuntu中,它位于libgl1-mesa-dev软件包中。 So just do: 所以做:

sudo apt install libgl1-mesa-dev

I was able to fix my problem by following the instructions in this link: 我可以按照以下链接中的说明解决问题:

http://techtidings.blogspot.com/2012/01/problem-with-libglso-on-64-bit-ubuntu.html http://techtidings.blogspot.com/2012/01/problem-with-libglso-on-64-bit-ubuntu.html

(the final two commands) (最后两个命令)

sudo rm /usr/lib/x86_64-linux-gnu/libGL.so 
sudo ln -s /usr/lib/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so 

It's obvious that ld doesn't find lib GL in default library path which should be include /lib* /usr/lib* . 显然, ld在默认库路径中找不到lib GL该库路径应该包含/lib* /usr/lib* You should install library GL or tell g++ where lib GL was installed with cmd args -L if that was installed already. 您应该安装库GL或通过gmd args -L告诉g++GL安装位置(如果已安装)。

I am having the same problem.我有同样的问题。 then I use in terminal "sudo apt install mesa-common-dev libglu1-mesa-dev" and the application run perfectly.然后我在终端中使用“sudo apt install mesa-common-dev libglu1-mesa-dev”,应用程序运行完美。

"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM