简体   繁体   中英

in ubuntu 12.04 make cannot find Qt libraries

When I run make (after running qmake) I get the following error:

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

In synaptic it shows that I have installed libqtcore4 and libqtgui4.

There is no such directory as /usr/bin/ld.

Basically, I've installed the QtSDK, and QtCreator seems to work fine in that it can build the hello world program. But I want to be able to work from the CLI and run make. I suspect that I may need to redirect the make program to look elsewhere for QtGui and QtCore. If so, how do I find out where those libraries are? I'm running Ubuntu 12.04 and I've followed the advice of this page http://www.qtforum.org/article/28081/installing-qt-4-5-2-on-linux.html down to the last section where it talks about libraries. Any suggestions?

Install Qt using apt-get

sudo apt-get install libqt4-core libqt4-gui 

or if you want everything

sudo apt-get install libqt4-*

The advice at http://www.qtforum.org/article/28081/installing-qt-4-5-2-on-linux.html is outdated and useless in your case since you have a recent version of Ubuntu. It leads to having two different versions of Qt side by side, which is technically possible but hard to manage.

You should install the qtcreator Ubuntu package and just delete the /opt/qtsdk... directory and undo the modifications suggested by the outdated instructions. It is essential that your PATH is not tweaked so that it's the Ubuntu version of qmake that is found when called from the command line.

If you still have compilation problems after that, they're likely to be solved by installing more packages, such as libqt4-dev or others Qt-related packages.

Also, /usr/bin/ld is not a directory, it's the linker program.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM