未找到 Qt(标头和库)

未找到 Qt(标头和库)

我正在尝试安装程序并使用以下命令:

./configure

但是,出现了一个错误:

    checking for Qt... configure: error: Qt (>= Qt 3.2) (headers and libraries) not found. Please check your installation!

Config.log 文件:

    configure:28268: checking for Qt
configure: 28333: /usr/include/qt4/qstyle.h
configure: 28333: /usr/lib/qt3/include/qstyle.h
configure: 28333: /usr/lib/qt3/qstyle.h
configure: 28333: /usr/lib/qt/include/qstyle.h
configure: 28333: /usr/lib/qt/qstyle.h
configure: 28333: /usr/share/qt3/include/qstyle.h
configure: 28333: /usr/share/qt3/qstyle.h
configure: 28333: /usr/local/qt/include/qstyle.h
configure: 28333: /usr/include/qt/qstyle.h
configure: 28333: /usr/include/qstyle.h
configure: 28333: /usr/X11R6/include/X11/qt/qstyle.h
configure: 28333: /usr/X11R6/include/qt/qstyle.h
configure: 28333: /usr/X11R6/include/qt2/qstyle.h
configure: 28333: /usr/include/qt3/qstyle.h
configure: 28333: ./qstyle.h
configure:28451: rm -rf SunWS_cache; g++ -o conftest -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -O2 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common -INO -I.  -DQT_THREAD_SUPPORT  -D_REENTRANT  -L/usr/lib/qt3 -L/usr/lib   conftest.cc  -lqt-mt   -ldl  -lXext -lX11 -lSM -lICE  -lpthread 1>&5
conftest.cc:2:21: fatal error: qglobal.h: No such file or directory
 #include <qglobal.h>
                     ^
compilation terminated.
configure:28454: $? = 1
configure: failed program was:
#include "confdefs.h"
#include <qglobal.h>
#include <qapplication.h>
#include <qcursor.h>
#include <qstylefactory.h>
#include <private/qucomextra_p.h>
#if ! (QT_VERSION >= 0x030200)
#error 1
#endif

int main() {
    (void)QStyleFactory::create(QString::null);
    QCursor c(Qt::WhatsThisCursor);
    return 0;
}
configure:28494: error: Qt (>= Qt 3.2) (headers and libraries) not found. Please check your installation!
For more details about this problem, look at the end of config.log.

我已经安装了:

sudo apt-get install libqt4-*
sudo apt-get install qt5-default
sudo apt-get install qtcreator

但是,我仍然遇到相同的错误。有人能帮助我吗?

@Edit:问题可能出在 Qt 文件的 PATH 上,因为我在文件夹 /usr/include/qt4/qt 中找到了“qstyle.h”。

答案1

运行 Debian Wheezy 我安装了以下软件包以成功配置:

libqt4-dev (4:4.8.2+dfsg-11)
libqt4-dev-bin (4:4.8.2+dfsg-11)
libqt4-opengl-dev (4:4.8.2+dfsg-11)
libqtwebkit-dev (2.2.1-5)
qt4-linguist-tools (4:4.8.2+dfsg-11)
qt4-qmake (4:4.8.2+dfsg-11)

答案2

搜索哪个包包含 Qt5 头文件让我首先看到了这篇文章。以防其他人也遇到这种情况;

Ubuntu 18.04 'bionic',Qt5 标头位于 qtbase5-dev 中

答案3

如果你运行:

qmake -query QT_INSTALL_HEADERS

这将返回 Qt 头文件的位置,例如:/usr/include/x86_64-linux-gnu/qt5

来源:https://stackoverflow.com/questions/56092404/how-to-find-location-of-qt-include-headers-on-linux

相关内容