【问题标题】:QtTest/QtTest: No such file or directoryQtTest/QtTest:没有这样的文件或目录
【发布时间】:2020-11-23 10:38:01
【问题描述】:

我尝试从 Qt 示例 (.../Qt/Examples/Qt-5.14.2/qtestlib/tutorial1/) 执行 Qt 单元测试应用程序

我愿意:

qmake -o Makefile tutorial1.pro
make

我明白了:

g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_TESTLIB_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtTest -I/usr/include/qt4 -I. -I. -o testqstring.o testqstring.cpp

testqstring.cpp:52:10: fatal error: QtTest/QtTest: No such file or directory
#include <QtTest/QtTest>
          ^~~~~~~~~~~~~~~
compilation terminated.
Makefile:205: recipe for target 'testqstring.o' failed
make: *** [testqstring.o] Error 1

怎么了?我用的是 xubuntu 18.04

【问题讨论】:

  • doc.qt.io/qt-5/… 这三个命令有效吗? qmake -project "QT += testlib"qmakemake
  • @ankii 不,有相同的输出
  • @ankii 我观察到/usr/include/ 目录中没有文件夹qt4
  • 我已经通过 brew 安装了 Qt(仅限 macOS)并且它在(我仍然需要检查如何将它干净地包含在 C++ 文件中)/usr/local/Cellar/qt/5.14.1/lib/QtTest.framework/Versions/5/Headers/QtTest你可以试试这个stackoverflow.com/questions/2752352/…如果一切都失败了,回退到特定于您的机器的硬编码完整路径。
  • 实际上它是符号链接的,应该添加/usr/local/Cellar/qt/5.14.1/include/QtTest 以包含路径,然后标题应包含为&lt;QtTest/QtTest&gt;

标签: c++ linux qt ubuntu


【解决方案1】:

尝试从 Qt 安装文件夹调用 qmake:

<QT-PATH>/Qt/Qt-5.14.2/gcc_64/bin/qmake

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-24
    • 2015-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-17
    • 2016-05-06
    相关资源
    最近更新 更多