QtTest/QtTest: No such file or directory - c++

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

Try calling qmake from Qt installation folder with:
<QT-PATH>/Qt/Qt-5.14.2/gcc_64/bin/qmake

Related

QT 5.x compilation of Windows software on Linux

I'm trying to compile windows software on linux with qt but each time I try to compile I get the following error:
i686-w64-mingw32.static-g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I/mxe/usr/i686-w64-mingw32.static/qt5/include -I/mxe/usr/i686-w64-mingw32.static/qt5/include/QtSvg -I/mxe/usr/i686-w64-mingw32.static/qt5/include/QtWidgets -I/mxe/usr/i686-w64-mingw32.static/qt5/include/QtGui -I/mxe/usr/i686-w64-mingw32.static/qt5/include/QtNetwork -I/mxe/usr/i686-w64-mingw32.static/qt5/include/QtCore -Irelease -I. -I/mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++ -o release/inventoryview.o View/inventoryview.cpp
In file included from View/inventoryview.cpp:2:0:
./ui_inventoryview.h:21:50: fatal error: Widget\Inventory\inventoryplusbutton.h: No such file or directory
compilation terminated.
Makefile.Release:6009: recipe for target 'release/inventoryview.o' failed
make[1]: Leaving directory '/builds/Skytwoo/qt-test/Synaps-Software'
make[1]: * [release/inventoryview.o] Error 1
Makefile:36: recipe for target 'release' failed
make: * [release] Error 2
I check multiple times and every folder exists.
Everything is run on Ubuntu inside a docker container with this command.
make -f Makefile.Release
As BoBTFish said, you can't have \ (backslashes) in your path. What you have to do here is to change Widget\Inventory\inventoryplusbutton.h into Widget/Inventory/inventoryplusbutton.h and make sure it exists.

SDL/SDL_mixer.h: No such file or directory -compilation terminated?

I have zero experience with Linux.
Please kindly help me with error I'm getting whilst trying to compile this application:
http://winpe.com/gascop/
pi#raspberrypi:~ $ cd Downloads/gascop
pi#raspberrypi:~/Downloads/gascop $ qmake-qt4
pi#raspberrypi:~/Downloads/gascop $ make
g++ -c -pipe -O2 -D_REENTRANT -Wall -W -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -
DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -
I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o mainwin.o mainwin.cpp
In file included from mainwin.cpp:29:0:
mainwin.h:38:27: fatal error: SDL/SDL_mixer.h: No such file or directory
#include "SDL/SDL_mixer.h" ^ compilation terminated.
Makefile:254: recipe for target 'mainwin.o' failed
make: *** [mainwin.o] Error 1
I have installed both libsdl-mixer1.2-dev and SDL2_mixer_devel but it seems like compilator cannot allocate these.
How to deal with that?
Thanks for any advice!
If anyone still searching for solution, following worked for me:
sudo apt install libsdl1.2-dev libsdl-mixer1.2-dev

Python: Install sip

I wanted to install the python module sip (version 4.17) according to the documentation on my Windows 7 machine:
Download from the official page as described in the documentation
Unzip the repository to the folder C:\Python27\Lib\site-packages\sip-4.17
Configure the package with the command python.exe configure.py in this folder
Building the module mingw32-make fails.
Mingw's make returns the following error message:
mingw32-make[1]: Entering directory 'C:/Python27/Lib/site-packages/sip-4.17/sipgen'
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o main.o main.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o transform.o transform.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o gencode.o gencode.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o extracts.o extracts.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o export.o export.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o heap.o heap.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o parser.o parser.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o lexer.o lexer.c
g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,console -Wl,-s -o sip.exe main.o transform.o gencode.o extracts.o export.o heap.o parser.o lexer.o
mingw32-make[1]: Leaving directory 'C:/Python27/Lib/site-packages/sip-4.17/sipgen'
mingw32-make[1]: Entering directory 'C:/Python27/Lib/site-packages/sip-4.17/siplib'
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o siplib.o siplib.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o apiversions.o apiversions.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o descriptors.o descriptors.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o qtlib.o qtlib.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o threads.o threads.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o objmap.o objmap.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o voidptr.o voidptr.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o array.o array.c
g++ -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o bool.o bool.cpp
g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -shared -Wl,-subsystem,console -Wl,-s -o sip.pyd siplib.o apiversions.o descriptors.o qtlib.o threads.o objmap.o voidptr.o array.o bool.o -LC:\Python27\libs -lpython27
C:\Python27\libs/libpython27.a: error adding symbols: File format not recognized
collect2.exe: error: ld returned 1 exit status
Makefile:36: recipe for target 'sip.pyd' failed
mingw32-make[1]: *** [sip.pyd] Error 1
mingw32-make[1]: Leaving directory 'C:/Python27/Lib/site-packages/sip-4.17/siplib'
Makefile:3: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
I have no clue why it failed to compile the code saying File format not recognized. Is it the same mistake as in g++ output: file not recognized: File format not recognized?
Thank you for your help in advance!
Comment:
I followed the following questions too but I want to install it using the zip file - so I know what is installed.
Can't configure pyQt
How to install SIP & PyQT on windows 7
How did you configure SIP? You need to choose a configuration option (see documentation in the docs file of the SIP archive). I got this to work once I chose --platform win32-g++.

Compiling wtwithqt example with QtCreator(qmake)

I am working on a network management application with Qt and I chose to use Wt for UI, because with it I will not have to deal with any of web parts (PHP, AJAX, HTML/CSS) and it'll be usable on all platforms.
I successfully managed to compile and run examples using cmake. Although I am used to QtCreator IDE and qmake I would rather use that for development and compiling.
I got stuck trying to compile "wtwithqt" example in QtCreator(qmake). I've been searching everywhere for some guide how to compile it with qmake. However I found nothing helpful.
Here is my .pro file.
testWt.pro
QT += core
QT -= gui
TARGET = helloqt
CONFIG += console no_keywords
CONFIG -=app_bundle
TEMPLATE = app
INCLUDEPATH += lib
LIBS += -lwt -lwthttp -lboost_signals -lboost_system -lboost_regex
QMAKE_CXXFLAGS += -DNDEBUG
HEADERS += \
QtObject.h \
HelloApplication.h
SOURCES += \
hello.cpp \
QtObject.cpp
Compile ouput
13:28:15: Running build steps for project testWt...
13:28:15: Starting: "/usr/bin/make" clean -w
make: Entering directory `/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
/usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ CONFIG+=debug CONFIG+=declarative_debug -o Makefile ../testWt/testWt.pro
make: Leaving directory `/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
make: Entering directory `/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
rm -f moc_QtObject.cpp
rm -f hello.o QtObject.o moc_QtObject.o
rm -f *~ core *.core
make: Leaving directory `/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
13:28:15: The process "/usr/bin/make" exited normally.
13:28:15: Configuration unchanged, skipping qmake step.
13:28:15: Starting: "/usr/bin/make" -w
make: Entering directory `/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
g++ -c -pipe -DNDEBUG -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_KEYWORDS -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testWt -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I../testWt/lib -I. -I../testWt -I. -o hello.o ../testWt/hello.cpp
g++ -c -pipe -DNDEBUG -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_KEYWORDS -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testWt -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I../testWt/lib -I. -I../testWt -I. -o QtObject.o ../testWt/QtObject.cpp
/usr/bin/moc-qt4 -DQT_WEBKIT -DQT_NO_KEYWORDS -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testWt -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I../testWt/lib -I. -I../testWt -I. ../testWt/QtObject.h -o moc_QtObject.cpp
g++ -c -pipe -DNDEBUG -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_KEYWORDS -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testWt -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I../testWt/lib -I. -I../testWt -I. -o moc_QtObject.o moc_QtObject.cpp
g++ -o helloqt hello.o QtObject.o moc_QtObject.o -L/usr/lib/i386-linux-gnu -lwt -lwthttp -lboost_signals -lboost_system -lboost_regex -lQtCore -lpthread
hello.o: In function `HelloApplication':
/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug/../testWt/hello.cpp:43: undefined reference to `Wt::WQApplication::WQApplication(Wt::WEnvironment const&, bool)'
hello.o: In function `HelloApplication::propagateGreet()':
/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug/../testWt/hello.cpp:87: undefined reference to `Wt::toQString(Wt::WString const&)'
hello.o: In function `HelloApplication::doGreet(QString const&)':
/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug/../testWt/hello.cpp:92: undefined reference to `Wt::toWString(QString const&)'
hello.o: In function `~WQApplication':
/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug/../testWt/lib/WQApplication:82: undefined reference to `vtable for Wt::WQApplication'
hello.o:(.rodata._ZTV16HelloApplication[vtable for HelloApplication]+0x3c): undefined reference to `Wt::WQApplication::initialize()'
hello.o:(.rodata._ZTV16HelloApplication[vtable for HelloApplication]+0x40): undefined reference to `Wt::WQApplication::finalize()'
hello.o:(.rodata._ZTV16HelloApplication[vtable for HelloApplication]+0x44): undefined reference to `Wt::WQApplication::notify(Wt::WEvent const&)'
hello.o:(.rodata._ZTV16HelloApplication[vtable for HelloApplication]+0x5c): undefined reference to `Wt::WQApplication::realNotify(Wt::WEvent const&)'
hello.o:(.rodata._ZTI16HelloApplication[typeinfo for HelloApplication]+0x8): undefined reference to `typeinfo for Wt::WQApplication'
collect2: ld returned 1 exit status
make: Leaving directory `/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
make: *** [helloqt] Error 1
13:28:28: The process "/usr/bin/make" exited with code 2.
Error while building project testWt (target: Desktop)
When executing build step 'Make'
Any help is appreciated! Thanks in advance!
Your makefile is pretty much sound, but I think you've forgotten to link the wtwitqt interop layer. Add -lwtwithqt to the LIBS line,

Combine two GCC commands / Make one Makefile out of two (QT and GCC Plugin)

I wrote a GCC Plugin which works very well. I created a Makefile which executes the following command to create the Plugin:
$ g++ -I$(INCLUDE_PATHS) -fPIC -shared $(SOURCE_PATHS) -o Plugin.so
I execute the Plugin with following command:
$ g++ -S -fplugin=./Plugin.so /TestProgramm.cpp
This works pretty well. Now I want to display a QT GUI when calling the Plugin. I wrote the GUI in Eclipse, so i got an auto-generated MakeFile. When executing the GUI, Eclipse executes following commands:
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I$(QT_INCLUDE_PATHS) -o debug/GUI.o GUI.cpp
g++ -Wl,-rpath,/opt/QtSDK/Desktop/Qt/4.8.1/gcc/lib -o GraphGUI debug/GUI.o debug/main.o debug/GraphGUI.o debug/moc_GraphGUI.o -L/opt/QtSDK/Desktop/Qt/4.8.1/gcc/lib -lQtGui -L/opt/QtSDK/Desktop/Qt/4.8.1/gcc/lib -L/usr/X11R6/lib -lQtCore -lpthread
GraphGUI and GUI are the classes of the GUI I wrote.
Now I want to combine these statements in my own Makefile, so that the Compiler compiles my Plugin and my GUI. I started working with Makefiles a few days ago, so I only got the basics about Makefiles. Hope somebody can help me.
Here is my Makefile:
GCC := g++
FILENAME := Explorer.so
GCC_INCLUDE := -I/usr/lib/gcc/i686-linux-gnu/4.6/plugin/include
QT_INCLUDE := -I/opt/QtSDK/Desktop/Qt/4.8.1/gcc/mkspecs/default \
-I/opt/QtSDK/Desktop/Qt/4.8.1/gcc/include/QtCore \
-I/opt/QtSDK/Desktop/Qt/4.8.1/gcc/include/QtGui \
-I/opt/QtSDK/Desktop/Qt/4.8.1/gcc/include
SOURCE_FILES = ## Some .cpp files for the plugin ##
$(FILENAME):
#$(GCC) $(GCC_INCLUDE) -fPIC -shared $(SOURCE_FILES) -o $# $^
clean:
#rm $(FILENAME)
I tried creating object files of the GUI and then include them in the command which creates the Plugin; like this:
$(GCC) -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED $(QT_INCLUDE) -Idebug -I. -o debug/GUI.o src/Visualize/GUI.cpp
$(GCC) -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED $(QT_INCLUDE) -Idebug -I. -o debug/GraphGUI.o src/Visualize/GraphGUI.cpp
# /opt/QtSDK/Desktop/Qt/4.8.1/gcc/bin/moc -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED $(QT_INCLUDE) -Idebug -I. src/Visualize/GraphGUI.h -o debug/moc_GraphGUI.cpp
# $(GCC) -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED $(QT_INCLUDE) -Idebug -I. -o debug/moc_GraphGUI.o debug/moc_GraphGUI.cpp
$(GCC) $(PLUGIN_INCLUDE) -fPIC -shared $(SOURCE_FILES) debug/GraphGUI.o debug/GUI.o -o $# $^
If i execute it like this, I get undefined symbol: _ZN11QMainWindowC2EP7QWidget6QFlagsIN2Qt10WindowTypeEE error. If I execute the two commands beginning with "#" too, I get "undefined reference to main". I just copied these commands from eclipse; I don't actually know what they are doing.