Search code examples
c++qtwindows-7-x64qmakeundefined-reference

Compiling QT in windows 64 - undefined reference to


Ok. I just installed Qt from: http://qt.nokia.com/downloads using the online installer. I have MinGW, make, gcc and g++ installed. I also added variables QMAKESPEC and QTDIR and also appended the directories in MinGW and Qt to the PATH variable. When running qmake and make I get a ton of errors about undefined reference to QGraphicsScene, QGraphicsView, etc.

Here's one of many:

./debug/mox_roiwindow.o:moc_roiwindow.cpp:(.rdata$_ZTV9roiwindow[vtavle for roiwindow]+0x74): undefined reference to 'QGRaphcisScene::drawForeground(QPainter*, QRectF const&)'

The LIBS section in the makefile is:

LIBS = -L'c:/QtSDK/Desktop/Qt/4.8.0/msvc2008/lib' -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4

The INCLUDE section is:

INCPATH = -I'../../../../QtSDK/Desktop/Qt/4.8.0/msvc2008/include/QtCore' -I'../../../../QtSDK/Desktop/Qt/4.8.0/msvc2008/include/QtGui'

This appears to be correct. I tried to look up a solution via google and either found nothing or the solutions didn't seem to help. Thanks.


Solution

  • Somethings weird.... You are trying to link mingw32, and at the same time you are using a msvc2008 library path. They are separate and non-compatible compilers environments, so if you try linking objects compile from both you may have this error. What compiler are you using?? Are you using QtCreator? The compiler must be the same as the one which is used to compile the Qt libraries...