-1

I try to perform Qt unit test app from Qt example (.../Qt/Examples/Qt-5.14.2/qtestlib/tutorial1/)

I do:

qmake -o Makefile tutorial1.pro
make

I get:

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

What is wrong? I use xubuntu 18.04

  • https://doc.qt.io/qt-5/qttestlib-tutorial1-example.html#executing-a-test do these 3 commands work ? `qmake -project "QT += testlib"` `qmake` `make` –  Aug 03 '20 at 11:13
  • @ankii no, there is the same output – Alexandr Zhukov Aug 03 '20 at 11:16
  • @ankii i observed that there is no folder `qt4` in `/usr/include/` directory – Alexandr Zhukov Aug 03 '20 at 11:25
  • I have Qt installed via brew (macOS only) and it's in (I still have to check how to include it cleanly in C++ files)`/usr/local/Cellar/qt/5.14.1/lib/QtTest.framework/Versions/5/Headers/QtTest` You may try this https://stackoverflow.com/questions/2752352/how-to-add-include-path-in-qt-creato If all fails, fallback to hardcoded full path specific to your machine. –  Aug 03 '20 at 11:29
  • Actually it's symlinked and `/usr/local/Cellar/qt/5.14.1/include/QtTest` should be added to include path & then headers should be included as ``. –  Aug 03 '20 at 11:38

1 Answers1

0

Try calling qmake from Qt installation folder with:

<QT-PATH>/Qt/Qt-5.14.2/gcc_64/bin/qmake
zziyaa
  • 51
  • 2