/usr/bin/ld:kann -lGL nicht finden

/usr/bin/ld:kann -lGL nicht finden


Ich habe qt installiert und wenn ich eine Anwendung auf qt ausführe, erhalte ich diesen Fehler.


 /usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make: *** [test3] Error 1
14:05:48: The process "/usr/bin/make" exited with code 2.

Ich denke, dieser Fehler hängt mit OpenGL zusammen.

Ich habe all diese Befehle ausgeführt, aber es ist nichts passiert


 sudo apt-get install libgl1-mesa-dev
sudo apt-get install libgl1-mesa-glx libgl1-mesa-dev

Meine Profildatei ist:


  #-------------------------------------------------
#
# Project created by QtCreator 2015-05-19T17:40:19
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = test19
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui

Einige Code-Antworten


g++ main.cpp -w -lglut -lGl -o bin/app 
g++ main.cpp -w -lglut -lGL -o bin/app 
/usr/bin/ld: cannot find -lGl collect2: error: ld returned 1 exit status Makefile:16: recipe for target 'all' failed make: *** [all] Error 1 
Ubuntu 16.04 LTS 
gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2) 
/usr/lib/x86_64-linux-gnu$ find libGL.so libGL.so 
freeglut3 freeglut3-dev libglew1.5 libglew1.5-dev libglu1-mesa libglu1-mesa-dev libgl1-mesa-glx libgl1-mesa-dev 
glxinfo OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 5500 (Broadwell GT2)  OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.0 OpenGL core profile shading language version string: 3.30 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 3.0 Mesa 11.2.0 OpenGL shading language version string: 1.30 OpenGL context flags: (none) OpenGL extensions: OpenGL ES profile version string: OpenGL ES 3.1 Mesa 11.2.0 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10 OpenGL ES profile extensions: 
 /usr/lib/x86_64-linux-gnu/libGL.so: broken symbolic link to /usr/lib/libGL.so.1.2 2 
sudo apt-get install --reinstall libgl1-mesa-dev
sudo ln -s libGL.so.1.7.0 libGL.so