Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946
[SOLVED] qmake - how to correctly setup the .pro file ?
I'm writing some classes defined in several files. The test application is defined in a sub directory and I can't correctly setup the .pro file.
Here is the source tree (don't pay attention to the filenames):
Using QTCreator I added all the header and cpp files into the project and ran qmake. But When I compile the project, the compiler doesn't find <QStringList> which is included in file1.cpp.
I added INCLUDEPATH is the .pro file and ran qt but it is worth.
When compiling the files created by qtcreator mainwindow.* anf file1.cpp all the include paths are correctly passed to g++.
@g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\WeatherTest -I"..........\Qt\5.2.0\mingw48_32\include" -I"..........\Qt\5.2.0\mingw48_32\include\QtWidgets" -I"..........\Qt\5.2.0\mingw48_32\include\QtNetwork" -I"..........\Qt\5.2.0\mingw48_32\include\QtGui" -I"..........\Qt\5.2.0\mingw48_32\include\QtCore" -I"debug" -I"." -I"." -I"..........\Qt\5.2.0\mingw48_32\mkspecs\win32-g++" -o debug\file1.o ......\Files\file1.cpp@
but when compiling file2 no include paths are specified !!!!
@g++ -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN ../../../Files/file2.cpp -o ../../../Files/file2@
How Can I add several external source files into Qt without getting mad ?
Asperamanca last edited by
It would help if you posted the content of your pro file.
I fixed it.
the issue was not in the .pro file but in the source files.
lib2.h included a file named File1 (not file1.h) this file contained
It seems that when source files include header named with not .h extension, no include paths are passed to g++.
Does File1 exists ?
When you include a file whether it ends or not with a .h, the file must still exist
otherwise g++ would tell me it doesn't find the included file.