I was trying to compile a project I checked out from github but I get these errors:

/usr/bin/ld: cannot find -lQtGui
/usr/bin/ld: cannot find -lQtNetwork
/usr/bin/ld: cannot find -lQtCore

It worked before but then I installed some application that pulled in Qt5 and nothing works anymore. How do I diagnose what's wrong or the reason why linker can't find these libraries.

  • If it worked previously with Qt4, have you tried setting the QT_SELECT environment variable before starting the build process e.g. export QT_SELECT=qt4? – steeldriver Apr 13 '16 at 13:52

If you are building a Qt project, Qt Creator tool may be of use -- it supports multiple Qt versions to be set as build kits, you just need to have the proper compiler installed and locate the qmake file of the desired Qt.

If otherwise you are convinced to build something from command line (ex.: development is not the key goal), check the following:

qmake --version  # which qt
pkg-config --modversion QtCore #module version

And yes, export QT_SELECT = <desired Qt version> also works, when you need to switch versions for you build.

  • I did try qt creator and it gives me the same error. Here's my output if that is of any help. pastebin.com/aVXx6kzY – asdfgasdfas Apr 14 '16 at 0:32
  • Hmm. QT += core gui network in *.pro file ? Or dirty hack: LIBS+=-L"/usr/local/lib" ? – MasterAler Apr 14 '16 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.