![ubuntu14.04:用于qt开发的opengl](https://linux22.com/image/984683/ubuntu14.04%EF%BC%9A%E7%94%A8%E4%BA%8Eqt%E5%BC%80%E5%8F%91%E7%9A%84opengl.png)
半天以来我尝试让 qt-creator 进行编译...但出现错误。
当我开始编译 qt-creator 的标准图形项目(刚刚创建了这个空项目并尝试编译)时,这是我得到的输出:
15:49:05: Running steps for project colour-picker...
15:49:05: Skipping disabled step qmake.
15:49:05: Starting: "/usr/bin/make"
g++ -Wl,-rpath,/usr/local/bin/qt5.5.0/5.5/gcc_64 -Wl,-rpath,/usr/local/bin/qt5.5.0/5.5/gcc_64/lib -o colour-picker main.o mainwindow.o -L/usr/local/bin/qt5.5.0/5.5/gcc_64/lib -lQt5Gui -L/usr/lib64 -lQt5Core -lGL -lpthread
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make: *** [colour-picker] Error 1
15:49:05: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project colour-picker (kit: Desktop)
When executing step "Make"
15:49:05: Elapsed time: 00:00.
Sp 我认为缺少 gl 库。(通过编译控制台项目,它可以工作。所以我可以看到生成的空窗口。)如果我搜索 gl 库:
find -name *gl.so*
./home/fabian/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libfltk_gl.so.1.1
./home/fabian/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libfltk_gl.so.1.1
./home/fabian/.local/share/Steam/steamapps/common/GarrysMod/bin/libtogl.so
./home/fabian/.local/share/Steam/steamapps/common/Team Fortress 2/bin/libtogl.so
./usr/lib/xorg/modules/libglamoregl.so
./usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so
./usr/lib/x86_64-linux-gnu/libwayland-egl.so.1
./usr/lib/x86_64-linux-gnu/libcogl.so.15.3.1
./usr/lib/x86_64-linux-gnu/libwayland-egl.so.1.0.0
./usr/lib/x86_64-linux-gnu/libcogl.so.15
./usr/lib/compiz/libopengl.so
.. 找到了,但是我认为在错误的目录和名称下(最后一个条目(libopengl.so)?我是对的吗?如果是这样该怎么办?
另外,如果我在控制台中输入一些内容,会发现:
ldconfig -p | grep libGL.so
libGL.so.1 (libc6,x86-64) => /usr/lib/nvidia-352/libGL.so.1
libGL.so.1 (libc6) => /usr/lib32/nvidia-352/libGL.so.1
libGL.so (libc6,x86-64) => /usr/lib/nvidia-352/libGL.so
libGL.so (libc6) => /usr/lib32/nvidia-352/libGL.so
为了理解:链接到 gl 库的指令来自哪里?我找不到它
谢谢你的帮助
答案1
似乎我可以通过删除来解决问题:
sudo apt-get purge libcheese-gtk23, libclutter-1.0-0, libcheese7
虽然 skype 或 steam 等都需要这些库。所以我不得不重新安装 skype 并重新配置 steam。
此后一切又恢复正常