Solved Run a working project on a new Computer
-
Hello !
I just changed computer and I'm not able to run my project anymore. I keep having this error : "crt0_c.c:-1: error : undefined reference to `WinMain@16'"
I've been looking on the web for this problem, and it is obviously some compiler problem.
Here is my kit :
Here are my Build settings :
I do have a main :
Here is the compile output :
This project used to work on my previous computer.
If anybody have a clue it would be very nice.Thanks
-
Hi @DavidM29,
It seems you installed way more Qt versions than needed. I'd recommend uninstalling the ones you don't wanne use to avoid confusion.
The selected MinGW kit looks good at first sight.
Which Qt version did you use before?
Have you completely removed all build artifacts and the .pro.user before opening the project?
I do have a main :
Yeah, but the error is:
crt0_c.c:-1: error : undefined reference to `WinMain@16
WinMain is the function that calls your main.
If the error still persists after carefully cleaning all build artifacts, can you show a build log for a full compile?
Regards
-
@aha_1980
I installed the complete package when I installed Qt so that is probably the reason why I do have as many kits.
How can I uninstall them ? Should I do it manually ? I never know which one should I used and if it is supposed to make any difference to be honest ...
EDIT : I found out with the Maintenance tool.I used Qt 5.10. on my previous computer, now it is 5.13 (latest version)
But why would it be looking for a WinMain ? I've never used WinMain before !
I do not have anymore build artifacts and .pro.user has been removed.
The complete Compile output :
(Sorry for the image format but don't know how to share it an other way... Too many character for a single post...)
-
you can upload such logs into paste services.
One strong advice: Don't use project directories with spaces or special charactes in it. That may be no problem here, but will sooner or later hit you somewhere else.
Regarding the problem: do you have a
libmingw32.a
? The path to this file looks extremely long and odd.Can you compile a minimal example from the wizards?
Regards
-
@aha_1980
Ok I clearly have some lacks...
What is "paste services" ?I'll change the name of the project then, that is true that special characters and spaces are usually source of problems.
What do you mean by "compile a minimal exemple" ? Create a new "Hello world" project and compile it for exemple ?
-
What is "paste services" ?
What do you mean by "compile a minimal exemple" ? Create a new "Hello world" project and compile it for exemple ?
Exactly.
Regards
-
@aha_1980
Ok thanks, I've never used this before...So, I've made a project named Test that is basicly a Qt Quick project made with the wizard.
Here is the output :10:20:35: Running steps for project Test... 10:20:35: Configuration unchanged, skipping qmake step. 10:20:35: Starting: "C:\Qt\Qt5.13.0\Tools\mingw730_32\bin\mingw32-make.exe" -j8 C:/Qt/Qt5.13.0/Tools/mingw730_32/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'C:/Users/dm/Documents/build-Test-Desktop_Qt_5_13_0_MinGW_32_bit-Debug' mingw32-make[1]: Nothing to be done for 'first'. mingw32-make[1]: Leaving directory 'C:/Users/dm/Documents/build-Test-Desktop_Qt_5_13_0_MinGW_32_bit-Debug' 10:20:37: The process "C:\Qt\Qt5.13.0\Tools\mingw730_32\bin\mingw32-make.exe" exited normally. 10:20:37: Elapsed time: 00:02.
But then I re-compiled my previous project and the compile output was shorter but with the same error.
Here it is :10:22:55: Running steps for project SimulateurTonne... 10:22:55: Configuration unchanged, skipping qmake step. 10:22:55: Starting: "C:\Qt\Qt5.13.0\Tools\mingw730_32\bin\mingw32-make.exe" -j8 cd app\ && ( if not exist Makefile C:\Qt\Qt5.13.0\5.13.0\mingw73_32\bin\qmake.exe -o Makefile "C:\Users\dm\Documents\Projets Qt\SimulateurTonne\app\app.pro" -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" ) && C:/Qt/Qt5.13.0/Tools/mingw730_32/bin/mingw32-make -f Makefile cd tests\ && ( if not exist Makefile C:\Qt\Qt5.13.0\5.13.0\mingw73_32\bin\qmake.exe -o Makefile "C:\Users\dm\Documents\Projets Qt\SimulateurTonne\tests\tests.pro" -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" ) && C:/Qt/Qt5.13.0/Tools/mingw730_32/bin/mingw32-make -f Makefile mingw32-make[1]: Entering directory 'C:/Users/dm/Documents/Projets Qt/build-SimulateurTonne-Desktop_Qt_5_13_0_MinGW_32_bit-Debug/tests' C:/Qt/Qt5.13.0/Tools/mingw730_32/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'C:/Users/dm/Documents/Projets Qt/build-SimulateurTonne-Desktop_Qt_5_13_0_MinGW_32_bit-Debug/app' C:/Qt/Qt5.13.0/Tools/mingw730_32/bin/mingw32-make -f Makefile.Debug mingw32-make[2]: Entering directory 'C:/Users/dm/Documents/Projets Qt/build-SimulateurTonne-Desktop_Qt_5_13_0_MinGW_32_bit-Debug/tests' g++ -Wl,-subsystem,console -mthreads -o debug\tests.exe debug/calculs.o debug/moc_calculs.o C:\Qt\Qt5.13.0\5.13.0\mingw73_32\lib\libQt5Testd.a C:\Qt\Qt5.13.0\5.13.0\mingw73_32\lib\libQt5Cored.a C:/Qt/Qt5.13.0/Tools/mingw730_32/bin/../lib/gcc/i686-w64-mingw32/7.3.0/../../../../i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x39): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status mingw32-make[2]: *** [Makefile.Debug:66: debug/tests.exe] Error 1 mingw32-make[1]: *** [Makefile:38: debug] Error 2 mingw32-make[2]: Leaving directory 'C:/Users/dm/Documents/Projets Qt/build-SimulateurTonne-Desktop_Qt_5_13_0_MinGW_32_bit-Debug/tests' mingw32-make[1]: Leaving directory 'C:/Users/dm/Documents/Projets Qt/build-SimulateurTonne-Desktop_Qt_5_13_0_MinGW_32_bit-Debug/tests' mingw32-make: *** [Makefile:69: sub-tests-make_first] Error 2 mingw32-make: *** Waiting for unfinished jobs.... mingw32-make[2]: Entering directory 'C:/Users/dm/Documents/Projets Qt/build-SimulateurTonne-Desktop_Qt_5_13_0_MinGW_32_bit-Debug/app' mingw32-make[2]: Nothing to be done for 'first'. mingw32-make[2]: Leaving directory 'C:/Users/dm/Documents/Projets Qt/build-SimulateurTonne-Desktop_Qt_5_13_0_MinGW_32_bit-Debug/app' mingw32-make[1]: Leaving directory 'C:/Users/dm/Documents/Projets Qt/build-SimulateurTonne-Desktop_Qt_5_13_0_MinGW_32_bit-Debug/app' 10:22:58: The process "C:\Qt\Qt5.13.0\Tools\mingw730_32\bin\mingw32-make.exe" exited with code 2. Error while building/deploying project SimulateurTonne (kit: Desktop Qt 5.13.0 MinGW 32-bit) When executing step "Make" 10:22:58: Elapsed time: 00:03.
-
@DavidM29 can you show the .pro file for the specific target (it seems you have multiple targets in a SUBDIRS project?)
-
@aha_1980
Yes I do have a "main" .pro which is this one
Called with the name of my project :TEMPLATE = subdirs SUBDIRS += app tests \
Then I do have my app repertory with the following app.pro :
QT += quick CONFIG += c++11 # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ radialbar.cpp \ pressuremeter.cpp \ dpameter.cpp \ calculs.cpp \ context.cpp \ keyboardhelper.cpp \ vannemeter.cpp \ trans.cpp RESOURCES += qml.qrc \ image.qrc \ font.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target HEADERS += \ radialbar.h \ pressuremeter.h \ dpameter.h \ calculs.h \ context.h \ keyboardhelper.h \ vannemeter.h \ trans.h DISTFILES += \ qmldir
Then I do have unitary test in a folder called test with the test.pro attached :
QT += quick CONFIG += c++11 # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Refer to the documentation for the # deprecated API to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
-
@DavidM29 just for clarification, it's the tests project that fails to link?
-
-
g++ -Wl,-subsystem,console -mthreads -o debug\tests.exe debug/calculs.o debug/moc_calculs.o C:\Qt\Qt5.13.0\5.13.0\mingw73_32\lib\libQt5Testd.a C:\Qt\Qt5.13.0\5.13.0\mingw73_32\lib\libQt5Cored.a
C:/Qt/Qt5.13.0/Tools/mingw730_32/bin/../lib/gcc/i686-w64-mingw32/7.3.0/../../../../i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x39): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit statusdebug\tests.exe
<- Your tests? -
@aha_1980
Yes you are right...
It is my tests files.... Why does it try to run them ?Edit : Indeed I try to remove the "tests" sub from my project .pro file and no the app is running...
But my tests used to work as well before ... But it is very good to know what make this error.Edit 2 : I finally found my problem... I had a missing file in my test.pro ... Adding this missing file solve my problem.
I can keep my test and my app Launch properly !
Thanks a lot for you help ! -
Hi @DavidM29,
glad you could solve it! So please mark this topic as SOLVED too. Thanks!