user2423772
user2423772

Reputation: 186

Qt5 Linux cannot find Qt libraries

I am trying to compile an existing QT library with QT5.1 Beta on Ubuntu 12.04 with Clang. This project compiles fine with QT4.8.4.

I am getting the below linker error when I compile the project with QT5.1 Beta.

/usr/bin/ld: cannot find -lQt5OpenGL
/usr/bin/ld: cannot find -lQt5Widgets
/usr/bin/ld: cannot find -lQt5Network
/usr/bin/ld: cannot find -lQt5Gui
/usr/bin/ld: cannot find -lQt5Core

My current system setup is as follows:

I am getting the error on both launching the qtcreator from icon and bash.

The developer who was using this ubuntu system before had installed QT4 using apt-get. I think QT4 got installed in the default OS directories and QT4 gets picked up always rather than QT5 when I build my project. I removed the QT4 packages that were under /usr/** path

When the build fails ,I see the below command being executed in qtcreator's compiler output window.

clang++  debug/moc-xxx.o -L -L/home/user/Qt5.1.0/5.1.0-beta1/gcc_64/lib -lQ5OpenGL -lQt5Widgets -lQt5Network -lQt5Gui -lGL -lpthread

Does the -L with no path tell the compiler to use the libs from the system's default paths? What am I missing here?

Upvotes: 1

Views: 4967

Answers (1)

trig-ger
trig-ger

Reputation: 1205

You need to compile Qt with Clang first (Clang-3.2 example): http://libre.tibirna.org/projects/qgit/wiki/Compile_Qt5_with_clang

because pre-built Linux Qt libraries are for gcc.

After building Qt you can configure the Kit for Qt Creator: http://libre.tibirna.org/projects/qgit/wiki/Compile_QGit_with_Qt5_and_clang

Upvotes: 0

Related Questions