Qt Creator not compiling on Windows 10
-
Dear community,
I have a complex Qt Widgets project which compiles just fine on a Linux environment. To get a Windows version, I installed Qt with MinGW from the online installer on a plain Windows 10 box. I copied the project tree, adapted .pro file source code for Windows specifics, installed all necessary libraries. I created a Windows/MinGW kit and tested if g++.exe works - it does.
When I start compiling the project, qmake and MinGW-make finish correctly.
g++, however, fails with "fatal error: no input files". This is where I get stuck. All sources and headers are in the project directory. I removed them from the .pro file and added them again with the "add existing file" function of Qt Creator in Windows. The .pro entries produced are identical to those in Linux. Most likely, I have made a stupid configuration mistake. I just can't find it. Help is highly appreciated.Compiler output:
g++: error: WINDOWS -I../WhiteGUI -I. -I../../../Win64/include -I../ WhiteEngine -I../WhiteEngine -I../WhiteEngine -I../WhiteEngine -IC:/Qt/6.1.2/ mingw81_64/include -IC:/Qt/6.1.2/mingw81_64/include/QtQuickControls2 -IC:/Qt/ 6.1.2/mingw81_64/include/QtQuick -IC:/Qt/6.1.2/mingw81_64/include/QtOpenGL - IC:/Qt/6.1.2/mingw81_64/include/QtWidgets -IC:/Qt/6.1.2/mingw81_64/include/ QtGui -IC:/Qt/6.1.2/mingw81_64/include/QtQmlModels -IC:/Qt/6.1.2/mingw81_64/ include/QtQml -IC:/Qt/6.1.2/mingw81_64/include/QtNetwork -IC:/Qt/6.1.2/ mingw81_64/include/QtCore -Idebug -I. -IC:/VulkanSDK/1.0.51.0/Include -IC:/Qt/ 6.1.2/mingw81_64/mkspecs/win32-g++ -o debug\whiteapi.o .. \WhiteEngine\whiteapi.cpp: No such file or directory g++: fatal error: no input files compilation terminated.``` Here is my .pro file: QT += core gui QT += quickcontrols2 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 CONFIG += c++17 WIN64 { INCLUDEPATH += ../../../Win64/include LIBS += -L ../../../Win64/libs -lcurl LIBS += -L ../../../Win64/libs -lcurl LIBS += -L ../../../Win64/libs -ljsoncpp LIBS += -lstdc++fs LIBS += -L ../../../Win64/libs -lboost_date_time LIBS += -L ../../../Win64/libs -lboost_system LIBS += -L ../../../Win64/libs -lQXlsx }else{ LIBS += -lcurl LIBS += -L/usr/local/lib64 -ljsoncpp LIBS += -lstdc++fs LIBS += -lboost_date_time LIBS += -lboost_system LIBS += -L/usr/local/lib64/QXlsx -lQXlsx INCLUDEPATH += /usr/include/glibc-2.0 INCLUDEPATH += /usr/local/include } # Compile defs for WhiteAPI class DEFINES -= WHITEAPI DEFINES += WHITEGUI RESOURCES +=resources.qrc \ ../../../Frontend/BreezeStyleSheets-master/breeze.qrc # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ ../WhiteEngine/whiteapi.cpp \ ../WhiteEngine/whitedata.cpp \ ../WhiteEngine/whitefile.cpp \ ../WhiteEngine/whitejson.cpp \ ../WhiteEngine/whitelog.cpp \ ../WhiteEngine/whiterequest.cpp \ ../WhiteEngine/whitestatus.cpp \ ../WhiteEngine/whitetimer.cpp \ ../WhiteEngine/whitetools.cpp \ ../WhiteEngine/whitetranslator.cpp \ ../WhiteEngine/apikey.cpp \ apiwizard.cpp \ detailam.cpp \ detailar.cpp \ detailrender.cpp \ importfile.cpp \ main.cpp \ models.cpp \ notyfier.cpp \ whitebar.cpp \ whiteclient.cpp \ whiteconfig.cpp \ whitegui.cpp \ whitelogin.cpp \ whitetimerpopup.cpp \ whiteview.cpp HEADERS += \ ../WhiteEngine/WhiteDefs.h \ ../WhiteEngine/WhiteIncludes.h \ ../WhiteEngine/apikey.h \ ../WhiteEngine/whiteapi.h \ ../WhiteEngine/whitedata.h \ ../WhiteEngine/whitefile.h \ ../WhiteEngine/whitejson.h \ ../WhiteEngine/whitelog.h \ ../WhiteEngine/whiterequest.h \ ../WhiteEngine/whitestatus.h \ ../WhiteEngine/whitetimer.h \ ../WhiteEngine/whitetools.h \ ../WhiteEngine/whitetranslator.h \ apiwizard.h \ detailam.h \ detailar.h \ detailrender.h \ importfile.h \ models.h \ notyfier.h \ whitebar.h \ whiteclient.h \ whiteconfig.h \ whitegui.h \ whitelogin.h \ whitetimerpopup.h \ whiteview.h FORMS += \ apiwizard.ui \ detailam.ui \ detailar.ui \ detailrender.ui \ importfile.ui \ models.ui \ whiteconfig.ui \ whitegui.ui \ whitelogin.ui \ whitetimerpopup.ui \ whiteview.ui INCLUDEPATH += ../WhiteEngine # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target FORMS += \ APIKeyGUI.ui INCLUDEPATH += ../WhiteEngine # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target DISTFILES += FORMS += \ APIKeyGUI.ui \ models.ui INCLUDEPATH += ../WhiteEngine # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target FORMS += \ APIKeyGUI.ui INCLUDEPATH += ../WhiteEngine # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target DISTFILES +=
-
@AxelVienna said in Qt Creator not compiling on Windows 10:
It is set in the project settings for the compile kit under “additional commands”.
Why? Why do you think when you enter something there QtCreator magically knows that it should be a define and be prefixed with '-DWINDOWS'?
No need for such a define at all - WIN32 is defined by default with every windows compiler. -
@AxelVienna The title is misleading: you're not compiling QtCreator, you're compiling inside QtCreator.
The actual error is: \WhiteEngine\whiteapi.cpp: No such file or directory
So, does WhiteEngine folder exist one level up relative to the pro file? -
Hi Jsulm,
thanks for your swift reply -> yes it is.axel@jupiter:~> cd WhiteDolphin/WhiteDolphinV2/WhiteDolphin/WhiteGUI/ axel@jupiter:~/WhiteDolphin/WhiteDolphinV2/WhiteDolphin/WhiteGUI> ll ../WhiteEngine/whiteapi.cpp -rw-r--r-- 1 axel users 16140 17. Jul 07:26 ../WhiteEngine/whiteapi.cpp axel@jupiter:~/WhiteDolphin/WhiteDolphinV2/WhiteDolphin/WhiteGUI>
Actually, all the files exist and my assumption is that the error message should lead me to another problem.
-
Your error is from Windows, your ls from Linux.
-
You are right, Christian.
Here is Windows:W:\>cd WhiteDolphin\WhiteDolphinV2\WhiteDolphin\WhiteGUI W:\WhiteDolphin\WhiteDolphinV2\WhiteDolphin\WhiteGUI>dir ..\WhiteEngine\whiteapi.cpp Datenträger in Laufwerk W: ist userhomes Volumeseriennummer: E7CE-5580 Verzeichnis von W:\WhiteDolphin\WhiteDolphinV2\WhiteDolphin\WhiteEngine 17.07.2021 07:26 16.140 whiteapi.cpp 1 Datei(en), 16.140 Bytes 0 Verzeichnis(se), 11.005.326.700.544 Bytes frei W:\WhiteDolphin\WhiteDolphinV2\WhiteDolphin\WhiteGUI>
-
And from where do you call make? Since your build dir is not your source dir I would guess it's wrong.
Use absolute paths, use your code into the current dir or create a separate library with a separate pro file but don't use relative paths for sources. -
Thanks Christian - good idea, done.
I have just copied the entire tree into a new directory and put all external sources (the ones with relative paths) into the project directory. I have removed the SOURCES and HEADERS section from the .pro file and added every file manually through the "add existing file" function.
The SOUCRES section reads as follows (HEADER section is identical except for .h instead of .cpp).SOURCES += \ whiteapi.cpp \ whitedata.cpp \ whitefile.cpp \ whitejson.cpp \ whitelog.cpp \ whiterequest.cpp \ whitestatus.cpp \ whitetimer.cpp \ whitetools.cpp \ whitetranslator.cpp \ apikey.cpp \ apiwizard.cpp \ detailam.cpp \ detailar.cpp \ detailrender.cpp \ importfile.cpp \ main.cpp \ models.cpp \ notyfier.cpp \ whitebar.cpp \ whiteclient.cpp \ whiteconfig.cpp \ whitegui.cpp \ whitelogin.cpp \ whitetimerpopup.cpp \ whiteview.cpp
Error message stays the same, save for absolute paths being used now.
g++: error: WINDOWS -IC:/Users/User/Documents/WhiteGUI -I. -I../../../Win64/include -I../WhiteEngine -I../WhiteEngine -I../WhiteEngine -I../WhiteEngine -IC:/Qt/6.1.2/mingw81_64/include -IC:/Qt/6.1.2/mingw81_64/include/QtQuickControls2 -IC:/Qt/6.1.2/mingw81_64/include/QtQuick -IC:/Qt/6.1.2/mingw81_64/include/QtOpenGL -IC:/Qt/6.1.2/mingw81_64/include/QtWidgets -IC:/Qt/6.1.2/mingw81_64/include/QtGui -IC:/Qt/6.1.2/mingw81_64/include/QtQmlModels -IC:/Qt/6.1.2/mingw81_64/include/QtQml -IC:/Qt/6.1.2/mingw81_64/include/QtNetwork -IC:/Qt/6.1.2/mingw81_64/include/QtCore -Idebug -I. -IC:/VulkanSDK/1.0.51.0/Include -IC:/Qt/6.1.2/mingw81_64/mkspecs/win32-g++ -o debug\whiteapi.o C:\Users\User\Documents\WhiteGUI\whiteapi.cpp: No such file or directory g++: fatal error: no input files compilation terminated.
The message clearly seems misleading as the file claimed to be missing is actually existing:
C:\Users\User\Documents\WhiteGUI>dir whiteapi.cpp Datenträger in Laufwerk C: ist Windows Volumeseriennummer: B2A1-AA19 Verzeichnis von C:\Users\User\Documents\WhiteGUI 17.07.2021 07:26 16.140 whiteapi.cpp 1 Datei(en), 16.140 Bytes 0 Verzeichnis(se), 160.223.092.736 Bytes frei C:\Users\User\Documents\WhiteGUI>
-
@AxelVienna
I could be wrong, but I am not 100% convinced that error message is saying quite what you think it is, from the way it is written. (It actually looks to me as though the whole long command line is being passed/treated as naming one file...?)Your error message starts:
g++: error: WINDOWS -IC:/Users/User/Documents/WhiteGUI ...
Where is that plain word
WINDOWS
at the beginning coming from?P.S.
If you open a Command Prompt and try, say,gcc "WINDOWS -IC:/Users/User/Documents/WhiteGUI -o debug\whiteapi.o C:\Users\User\Documents\WhiteGUI\whiteapi.cpp"
Note the quoting I have put in. How does the error message read for this? (Interested to see whether it echoes this whole line back with
: No such file or directory
at the end?) -
WINDOWS results from a define in the build target.
DEFINES+=WINDOWS
-
@AxelVienna
I don't know how that causesgcc WINDOWS ...
, which does not look right to me....In any case, I put in a P.S. for you to try, to see whether my suspicion is correct or mistaken?
-
@AxelVienna said in Qt Creator not compiling on Windows 10:
DEFINES+=WINDOWS
This is not in your pro file you posted above
@JonB : good catch
-
You are right, it is not in the .pro file. It is set in the project settings for the compile kit under “additional commands”. I use that excessively to trigger conditional code for different targets.
As your suggested command line input delivers the same error, I will give it a try and eliminate it. -
@AxelVienna said in Qt Creator not compiling on Windows 10:
WINDOWS results from a define in the build target.
DEFINES+=WINDOWSI can not find this in the project file from your first post.
But in this project, you have included 3 timesAPIKeyGUI.ui
inFORMS
and added 4 times../WhiteEngine
inINCLUDEPATH
.Perhaps you should first cleanup the pro file and remove redundant informations?
-
@AxelVienna said in Qt Creator not compiling on Windows 10:
It is set in the project settings for the compile kit under “additional commands”.
Why? Why do you think when you enter something there QtCreator magically knows that it should be a define and be prefixed with '-DWINDOWS'?
No need for such a define at all - WIN32 is defined by default with every windows compiler. -
Well, as I said in the very beginning: Most likely, I have made a stupid configuration mistake.
Thanks to all for pointing me to the right spot.