简体   繁体   English

在ubuntu 12.04 make中找不到Qt库

[英]in ubuntu 12.04 make cannot find Qt libraries

When I run make (after running qmake) I get the following error: 当我运行make(运行qmake之后)后,我收到以下错误:

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

In synaptic it shows that I have installed libqtcore4 and libqtgui4. 在synaptic中它显示我已经安装了libqtcore4和libqtgui4。

There is no such directory as /usr/bin/ld. 没有/ usr / bin / ld这样的目录。

Basically, I've installed the QtSDK, and QtCreator seems to work fine in that it can build the hello world program. 基本上,我已经安装了QtSDK,QtCreator似乎工作正常,因为它可以构建hello world程序。 But I want to be able to work from the CLI and run make. 但我希望能够从CLI工作并运行make。 I suspect that I may need to redirect the make program to look elsewhere for QtGui and QtCore. 我怀疑我可能需要重定向make程序以寻找QtGui和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. 我正在运行Ubuntu 12.04,我已按照本页的建议http://www.qtforum.org/article/28081/installing-qt-4-5-2-on-linux.html直到最后一节在哪里谈论图书馆。 Any suggestions? 有什么建议?

Install Qt using apt-get 使用apt-get安装Qt

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. http://www.qtforum.org/article/28081/installing-qt-4-5-2-on-linux.html上的建议已经过时且无用,因为您有最新版本的Ubuntu。 It leads to having two different versions of Qt side by side, which is technically possible but hard to manage. 它导致两个不同版本的Qt并排,这在技术上是可行的,但很难管理。

You should install the qtcreator Ubuntu package and just delete the /opt/qtsdk... directory and undo the modifications suggested by the outdated instructions. 您应该安装qtcreator Ubuntu软件包,然后删除/opt/qtsdk...目录并撤消过时指令建议的修改。 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. 必须对PATH进行调整,以便从命令行调用时找到的是qmake的Ubuntu版本。

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. 如果此后仍然存在编译问题,则可能通过安装更多软件包来解决这些问题,例如libqt4-dev或其他与Qt相关的软件包。

Also, /usr/bin/ld is not a directory, it's the linker program. 另外,/ usr / bin / ld不是目录,它是链接器程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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