- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
每当我将提交提交到 Git 时,我都试图让 Jenkins 为我进行编译和构建。我有一个在 Qt Creator 中创建的 helloworld 应用程序。它确实在 Qt Creator 中编译和构建,它确实显示在我的手机上,但它不想用 Jenkins 编译和构建。
我正在使用 QtC 使用的相同 shell 命令:
qmake helloworld.pro -r -spec android-g++;
make;
控制台输出为:
+ qmake helloworld.pro -r -spec android-g++
+ make
/home/ndk/toolchains/arm-linux-androideabi-4.9-/prebuilt/bin/arm-linux-androideabi-g++ -c -pipe -std=c++11 -O2 -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -mthumb -Wall -Wno-psabi -W -I/usr/share/qt4/mkspecs/android-g++ -I. -I. -I/home/ndk/sources/cxx-stl/gnu-libstdc++//include -I/home/ndk/sources/cxx-stl/gnu-libstdc++//libs//include -I/home/ndk/platforms//arch-arm//usr/include -o main.o main.cpp
In file included from main.cpp:1:0:
mainwindow.h:4:23: fatal error: QMainWindow: No such file or directory
#include <QMainWindow>
^
compilation terminated.
Makefile:187: recipe for target 'main.o' failed
make: *** [main.o] Error 1
我的 helloworld.pro:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = helloworld
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
CONFIG += mobility
MOBILITY =
main.cpp
#include "mainwindow.h"
#include <QMainWindow>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
编辑/更新:
到目前为止,我已经尝试指定 qmake 的完整路径,以确保我使用 Qt 的 qmake。
/home/qt/5.7/android_armv7/bin/qmake helloworld.pro -r -spec android-g++;
make;
输出是:
/home/qt/5.7/android_armv7/bin/uic mainwindow.ui -o ui_mainwindow.h
/home/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -O2 -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -mthumb -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../qt/5.7/android_armv7/include -I../../qt/5.7/android_armv7/include/QtWidgets -I../../qt/5.7/android_armv7/include/QtGui -I../../qt/5.7/android_armv7/include/QtCore -I. -I. -I../../ndk/sources/cxx-stl/gnu-libstdc++/4.9/include -I../../ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -I../../ndk/platforms/android-9/arch-arm/usr/include -I../../qt/5.7/android_armv7/mkspecs/android-g++ -o main.o main.cpp
/home/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -O2 -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -mthumb -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../qt/5.7/android_armv7/include -I../../qt/5.7/android_armv7/include/QtWidgets -I../../qt/5.7/android_armv7/include/QtGui -I../../qt/5.7/android_armv7/include/QtCore -I. -I. -I../../ndk/sources/cxx-stl/gnu-libstdc++/4.9/include -I../../ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -I../../ndk/platforms/android-9/arch-arm/usr/include -I../../qt/5.7/android_armv7/mkspecs/android-g++ -o mainwindow.o mainwindow.cpp
mainwindow.cpp:3:25: fatal error: QtGui/QAction: No such file or directory
#include <QtGui/QAction>
^
compilation terminated.
Makefile:1780: recipe for target 'mainwindow.o' failed
make: *** [mainwindow.o] Error 1
最佳答案
很可能您的 jenkins 设置使用了错误的 qmake
。 Qt 安装与其 qmake
之间存在 1:1 的映射关系。因此,您安装的 Qt for android 将有自己的 qmake,您必须通过完整路径引用它! Qt Creator 设置路径以便自动发生这种情况,Jenkins 不会 - 而且无论如何也不应该。
为任何特定的 Qt 版本构建时,您只需要显式调用其 qmake。从那时起,只要正确的编译器在路径中,事情就会按预期发生,您再也不需要手动引用该 Qt 版本。 makefile 将全部引用该 Qt 安装中的 Qt 库、头文件和工具。
您也不需要 -spec
参数。每个 Qt 安装都针对特定的 mkspec 进行编译,因此 qmake
本身确切地知道该规范是什么。我不知道为什么 QtCreator 会给出这样的论点,这没有多大意义。
关于c++ - qmake 与 Jenkins ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39017939/
在我的源树中,我有一堆资源,我想用 make install 将它们复制到我定义的目标路径。由于资源树有很多很多子目录,我希望 qmake 递归查找所有文件。 我试过: resources.pa
我想配置我的 qmake,这样我的可执行文件就会进入 ./build/debug(或发布)。我已使用以下代码成功完成此操作: CONFIG(debug, debug|release) { DE
我想使用 Qt 制作一个 GUI 应用程序,但无法开始。我在编辑器中编写了以下代码: #include #include int main(int argc, char *argv[]) {
我已经在 qt/c++ 中创建了一个应用程序 浏览器/Browser.pro 要启动浏览器,我需要一个代理。我已经创建了一个代理并将其存储在浏览器文件夹中 Browser/Browser.pro
我厌倦了编译 Qwt (或与此相关的任何其他 Qt 项目)每次发生变化时,例如 Qt 或体系结构的版本。所以: 我想将 Qwt 的 make 文件添加到我的项目中,以便编译后的 Qwt 文件进入我的影
我有一个Qt 程序。当我运行 qmake -project 和 qmake 时,它运行良好。 但是,现在我该如何运行我的程序呢? 谢谢。 最佳答案 make它,如果你在 Linux 中使用它。使用 n
我正在使用 qmake 和 Visual Studio。在发布版本中,qmake 将/GL 和/O2 标志添加到所有项目,我需要为我的整个 Qt 项目中的某些库删除这两个标志。有办法吗? 最佳答案 我
...它应该做但没有做。 这对我来说是 qmake 的主要挫折之一。 qbs 是我们 Qt 的 future ,但现在我们坚持使用 qmake。那么,有什么办法呢? 最佳答案 我滥用 QMAKE_EX
我正在使用 PRE_TARGETDEPS生成源文件,我将生成的源文件添加到 SOURCES用于编译。 我的生成器的输出显然在 qmake 运行时不存在,所以 qmake 输出 WARNING: Fai
我正在尝试通过 ubuntu 中的命令行编译 Qt 应用程序。对我来说,“which qmake”给出了/usr/bin。我在 PATH 变量中给出了 Qt/bin 路径。如何将qmake路径更改为Q
当使用 QMAKE_CXX = clang++ 强制在安装了 gcc 和 clang 的系统上使用 clang 时,clang++ 用于编译 .cpp 文件,但 g++ 是用于最后的链接。这在使用 U
我有一个共享库(没有 QT 依赖)[库 B],它链接到另一个共享库(也没有 QT 依赖)[库 A]。 我正在使用 Qmake 和 QT Creator 1.3。问题是,当我构建库 B 并在可执行文件上
有没有办法为 qmake 中的不同目标指定单独的编译选项? 例如: QMAKE_CXXFLAGS += -O SOURCES += file1.cpp QMAKE_CXXFLAGS += -st
我加了 version.target = version.h version.commands = bash generate-version.sh QMAKE_EXTRA_TARGETS += ve
qmake允许通过这样的命令行界面提供变量: qmake "CONFIG += release" "MY_VAR = hello" 所以我可以使用 $$MY_VAR里面.pro文件。但是有可能以这种方
我有一个看起来像这样的 qmake 项目: TEMPLATE = lib CONFIG += dll TARGET = mydll SOURCES += ... HEADERS += .... 现在我
我在弄清楚 qmake 如何处理依赖于另一个静态库的静态库的包含依赖项时遇到了一些问题。 我的文件夹结构如下: --- src/ lib1/ src/ (.pro,*.h,*.cpp) lib
我试图将我的项目从一台带有 qt4 的计算机转移到另一台我刚安装 qt5 的计算机,但我遇到了一个非常奇怪的问题。 qmake 突然找不到我的任何源文件或头文件。 这是一个极简主义的例子: QT
如 Undocumented qmake 中所述,我在我的 qmake 项目文件中声明了一个额外的编译器: TEST = somefile.h test_c.output = ${QMAKE_VAR_
这行在qmake .pro文件中是什么意思? TEMPLATE=aux 它是not documented,但是现在我测试它似乎不会引起错误或任何错误,并且我已经看到它在.pro中使用。 最佳答案 Go
我是一名优秀的程序员,十分优秀!