I'm trying to compile a simple Qt program with make after using CMake and I keep getting this error:
/usr/bin/ld: warning: libGL.so.1, needed by /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.5.1, not found (try using -rpath or -rpath-link)
/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.5.1: undefined reference to `glGetTexParameterfv'
/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.5.1: undefined reference to `glHint'
/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.5.1: undefined reference to `glClearColor'
/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.5.1: undefined reference to `glFlush'
...
collect2: error: ld returned 1 exit status
I have re-installed libgl1-mesa-dev
via sudo apt install --reinstall libgl1-mesa-dev
, made sure I have libGL.so.1
installed in my /usr/lib/x86_64-linux-gnu/mesa
directory and I have run sudo ldconfig
to no avail.
I'm not sure what is causing this and I haven't seen this problem anywhere else. It seems to be a dependency I'm ignoring, however I installed Qt using sudo apt install qt5-default
so I would think the dependencies would be handled.
Here's my CMakeLists.txt:
cmake_minimum_required(VERSION 2.6)
project(SimpleQt)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Widgets CONFIG REQUIRED)
include_directories(include)
add_executable(SimpleQt src/main.cpp)
target_link_libraries(growth Qt5::Widgets)