Compiling a Qt program in Windows XP using MinGW g ++

I have a Qt stub application and I keep getting compiler errors

#include <QApplication>

int main(int argc, char *argv[])
 {
     return 0;
 }

I used the commands qmake -projectand qmake, and as far as I can tell, they did their job correctly. When I subsequently call makethe command line, I get the following error:

g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I
'../../../../qt/include/QtCore' -I'../../../../qt/include/QtCore' -I'../../../..
/qt/include/QtGui' -I'../../../../qt/include/QtGui' -I'../../../../qt/include' -
I'.' -I'c:/qt/include/ActiveQt' -I'release' -I'.' -I'../../../../qt/mkspecs/defa
ult' -o release/Main.o Main.cpp
cc1plus.exe: Invalid option 'threads'
make[1]: *** [release/Main.o] Error 1
make: *** [release] Error 2

My google searches tell me that multithreading is important, but not how to fix this error. Any help would be appreciated.

EDIT (copied from the answer on the left):

Now I get:

g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel oc 
-Wl,-s -pthread -Wl -Wl,-subsystem,windows -o release/raytrace.exe 
object_scr ipt.raytrace.Release  -L'c:/qt/lib' -lmingw32 -lqtmain -lQtGui -lgdi32 
-lcomdlg3 2 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lkernel32 
-luser32 - lshell32 -luuid -lole32 -ladvapi32 -lws2_32 
g++: unrecognized option `-pthread' 
/cygnus/cygwin-b20/H-i586-cygwin32/i586-cygwin32/bin/ld: cannot open -lmsimg32: 
No such file or directory collect2: 
ld returned 1 exit status make[1]: *** 
[release/raytrace.exe] Error 1 make: *** [release] Error 2
+3
source share
4 answers

++ milot

I use MinGW to compile Qt on Windows, and this is the easiest way to make sure that you have everything you need.

Qt: http://trolltech.com/downloads/opensource/appdev/windows-cpp

" Qt MinGW: : 149,3 Mb".

MinGW Qt MinGW, , , MSYS MinGW.

+3

, , MingW, , , , Qt MingW, Qt. , Qt?

+2

Qt 4.5 Qt Creator 1.1, .

Qt Creator mucy .

VB IDE (, , , netbeans ..).

. .

+1

, .

MSYS "ls/mingw/lib/libmsimg32.a" , . (MinGW GCC 3.4.5). , -L/mingw/lib. , , , api- MinGW.

-pthread. Win32 api.

, , MinGW , MSYS, MSYS.

0

Source: https://habr.com/ru/post/1698228/


All Articles