c++ - Travis CI QT 未构建

标签 c++ qt travis-ci

所以我想用 travis 来处理 this今天的项目。可悲的是,它因这个错误而失败了:

$ make
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt5/mkspecs/linux-g++-64 -I. -I. -I/usr/include/qt5 -I/usr/include/qt5/QtNetwork -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -o downloadmanager.o downloadmanager.cpp
In file included from downloadmanager.h:11:0,
                 from downloadmanager.cpp:1:
mainwindow.h:4:23: fatal error: QMainWindow: No such file or directory
compilation terminated.
make: *** [downloadmanager.o] Error 1
The command "make" exited with 2.

Here是完整的日志。

请注意,我首先遇到的问题是无法识别网络模块文件(例如 QNetworkAccessManager)。我通过使用“QT += network”执行 QMake 来解决这个问题。现在它找不到 GUI 文件(例如 QMessageBox),但是添加“QT += network gui”没有成功。

最佳答案

你需要添加widgets来获取QMessageBoxQMainWindow等类:

QT += widgets network gui

为了将来引用,请查阅 Qt 5 文档。每个类的页面指示必须添加到该类的 qmake 中的内容(位于页面顶部)。例如,参见 QMessageBox 的页面.

关于c++ - Travis CI QT 未构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27694659/

相关文章:

c++ - 信号量、互斥体和条件变量的选择

c++ - Qt - 如何使用 QFile::copy 使用 QFileDialog 复制文件?

android - 为什么 Travis CI 每次构建时都要下载所有内容?

c++ - DLL 导出 : not all my functions are exported

c++ - const_iterator 和迭代器有什么区别?

c++ - 来自 Qt 文件的编译时错误 : expected unqualified-id before ')' token

c++ - 无法使用 QSerialPort 读取任何内容

gradle - 覆盖 Java Gradle 项目的默认 Travis CI 脚本

maven - 特拉维斯 : gpg: signing failed: secret key not available

c++ - 强制执行 constexpr 函数的 constexpr-ness 的惯用方式