gpt4 book ai didi

linux - Qt Creator 编译错误 "cannot find -lGL"。其他解决方案不起作用

转载 作者:太空狗 更新时间:2023-10-29 12:03:22 29 4
gpt4 key购买 nike

我已经在运行 ubuntu 12.04 的 amd 机器上安装了 QT5,它也带有 QT creator。如果重要的话,我的图形驱动程序是 radeon r9270x。

当我尝试编译一个基本的“hello world”类型的 Qt 程序时,我收到错误消息“找不到 -lGL”。我四处搜索(Qt: can't find -lGL error)它说使用“​​sudo apt-get install libgl1-mesa-dev”但是当我这样做时我已经安装了它。这里(Installing Qt on linux, cannot find -lGL)它说要安装“sudo apt-get install libgl-dev”,但这只会让我明白

"Reading package lists... Done Building dependency tree Reading state information... Done Package libgl-dev is a virtual package provided by: libgl1-mesa-swx11-dev 8.0.4-0ubuntu0.7
libgl1-mesa-dev-lts-trusty 10.1.3-0ubuntu0.1~precise1
libgl1-mesa-dev-lts-saucy 9.2.1-1ubuntu3~precise1
libgl1-mesa-dev-lts-raring 9.1.7-1ubuntu2~precise1
libgl1-mesa-dev-lts-quantal 9.0.3-0ubuntu0.4~precise1
libgl1-mesa-dev 8.0.4-0ubuntu0.7 You should explicitly select one to install.

E: Package 'libgl-dev' has no installation candidate"

我用过的各种其他资源都说可以做类似的事情,但我仍然遇到此错误。有任何想法吗?另一方面,不知道相关性,我无法让 QT Creator 启动最长时间。它总是会出现故障和核心转储。我终于更新了我的 amd catylist 控制中心/视频驱动程序并解决了这个问题。

这是 qt creator 的编译输出:

02:34:21: Running steps for project myHelloWorld... 02:34:21: Configuration unchanged, skipping qmake step. 02:34:21: Starting: "/usr/bin/make" g++ -Wl,-rpath,/media/UsbExternalDrive/DesignTools/Qt5.3/5.3/gcc_64 -Wl,-rpath,/media/UsbExternalDrive/DesignTools/Qt5.3/5.3/gcc_64/lib -o myHelloWorld main.o
-L/media/UsbExternalDrive/DesignTools/Qt5.3/5.3/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread /usr/bin/ld: cannot find -lGL collect2: ld returned 1 exit status make: *** [myHelloWorld] Error 1 02:34:21: The process "/usr/bin/make" exited with code 2. Error while building/deploying project myHelloWorld (kit: Desktop Qt 5.3 GCC 64bit) When executing step "Make" 02:34:21: Elapsed time: 00:00.

最佳答案

尝试运行它,重新启动 Qt creator 并尝试干净的构建。

sudo apt-get install mesa-common-dev

编辑:可能是您只是错过了 Mesa 包。查看列出的 XCB 依赖项 here并安装缺少的东西。

我在另一个案例中也看到过这个错误,但我不记得那里的解决方案了。我想我已经通过安装“libglu1-mesa-dev”包解决了这个问题。

sudo apt-get install libglu1-mesa-dev -y

但我不完全确定这是否已经解决了问题,或者我必须安装其他任何东西。

关于linux - Qt Creator 编译错误 "cannot find -lGL"。其他解决方案不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26436890/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com