/ usr / bin / ld: cannot find -lGL

I installed qt, and when I run the application on qt, I get this error.

 /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.

I think this error is related to OpenGL.
I executed all these commands, but nothing happened.

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

My pro file:

  #-------------------------------------------------
  #
  # 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
+4
source share
1 answer
Term

shows me this when I run the command

libGL.so.1 (libc6, x86-64, OS ABI: Linux 2.4.20) => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 libGL.so.1 (libc6, OS ABI : Linux 2.4.20) => /usr/lib/i386-linux-gnu/mesa/libGL.so.1

Own links that are not created when installing the necessary packages. I don’t know why, but here is how you can fix it:

sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/x86_64-linux-gnu/mesa/libGL.so
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/mesa/libGL.so
sudo ldconfig
0
source

All Articles