collect2.exe: error: ld returned 1 exit status
-
HI,
I have using qt4.8.4 and GNUWIN32 compiler , when ever i try running make i encounter following error on my windows system.D:\QT\test>qmake -project
D:\QT\test>qmake test.pro
D:\QT\test>make
make -f Makefile.Debug
make[1]: Entering directoryD:/QT/test' g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_SSE tCore" -I"c:\Qt\4.8.4\include\QtGui" -I"c:\Qt\4.8.4\include" -I"." -I"c:\Qt\4.8.4\include\ActiveQt" -I"debug" -I"c:\Qt\4.8.4\mkspecs\default" -o debug\test.o test.cpp g++ -mthreads -Wl,-subsystem,windows -o debug\test.exe debug/test.o -L"c:\Qt\4.8.4\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4 debug/test.o: In function
main':
D:\QT\test/test.cpp:5: undefined reference to_imp___ZN12QApplicationC1ERiPPci' D:\QT\test/test.cpp:6: undefined reference to
_imp___ZN6QLabelC1ERK7QStringP7QWidget6QFlagsIN2Qt10WindowTypeEE'
D:\QT\test/test.cpp:8: undefined reference to_imp___ZN12QApplication4execEv' D:\QT\test/test.cpp:8: undefined reference to
_imp___ZN12QApplicationD1Ev'
D:\QT\test/test.cpp:8: undefined reference to_imp___ZN12QApplicationD1Ev' debug/test.o: In function
ZN7QStringC1EPKc':
c:/Qt/4.8.4/include/QtCore/../../src/corelib/tools/qstring.h:419: undefined reference to_imp___ZN7QString16fromAscii_helperEPKci' debug/test.o: In function
ZN7QStringD1Ev':
c:/Qt/4.8.4/include/QtCore/../../src/corelib/tools/qstring.h:880: undefined reference to_imp___ZN7QString4freeEPNS_4DataE' collect2.exe: error: ld returned 1 exit status make[1]: *** [debug\test.exe] Error 1 make[1]: Leaving directory
D:/QT/test'
make: *** [debug] Error 2 -
Hello,
Are your qmake and Qt libraries compiled with the same comiler? If not this is the reason you get the undefined references. MSVS and mingw use different decorations and are not binary compatible.Kind regards.
-
@kshegunov is there any reference documentation where in qt installation on windows 7 is present.
-
@babravahan
Just look up what you've installed in the "Qt maintenance tool", there are a few checkboxes for different versions/compilers, look at what you've checked.Or try to get that from qmake, runningqmake -v
should give you the Qt version and the compiler used.Kind regards.