Try first if the simple demo app (the console project template) compiles with qmake command line:
SET PATH=%PATH%;C:\Qt\Qt5.9.1\5.9.1\mingw53_32\bin;C:\Qt\Qt5.9.1\Tools\mingw530_32\bin
C:\Qt\Qt5.9.1\5.9.1\mingw53_32\bin\qmake.exe -makefile C:\Software\test.pro -spec win32-g++
mingw32-make.exe
pause
Now trying to relink the application:
C:\Qt\Qt5.9.1\Tools\mingw530_32\bin\ld -o test release\main.o -LC:\Qt\Qt5.9.1\5.9.1\mingw53_32\bin -lQt5Core --verbose > ld_dump.txt
pause
Errors
main.o undefined reference to _Unwind_Resume
main.o undefined reference to __gxx_personality_v0
For comparison a slightly more complex app with QtWidgets prodcues even more errors (of course I added the missing Qt libs in the linker bat file)
moc_widget.o undefined reference to strcmp
moc_widget.o QObject undefined reference to vtable for __xyyabiv1:: __class_type_info
...
Googling error 1+2 they say it may be caused by different compilers. But I am using the same tool.
The pro file looks like
QT += core
QT -= gui
CONFIG += c++11
TARGET = test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
Do I maybe need to pass some kind of c++11 flag to the linker ld
?
I think ld needs a lot more information (e.g. it doesn't know anything about stdc++). Why don't you link using g++, instead? A line like this should work:
C:\Qt\Qt5.9.1\Tools\mingw530_32\bin\g++.exe \
-Wl,-rpath,C:\Qt\Qt5.9.1\5.9.1\mingw53_32\bin \
-o test release\main.o -LC:\Qt\Qt5.9.1\5.9.1\mingw53_32\bin -lQt5Core