[Qt-interest] Problem porting software to QT
Bill KING
bill.king at trolltech.com
Thu Apr 9 06:08:45 CEST 2009
Depends on where the class definition is, if it's in the header, make
sure your header is added to the HEADERS variable in the .pro.
If it's in the .cpp, then #include "cppfilename.moc" check some of the
qt source code for an example, (and don't forget to drop the .cpp)
fungos wrote:
> Hi, I'm trying to do a production software port to Qt, but when I add
> "Q_OBJECT" macro to an existing class I got these weird vtable errors,
> see:
>
> Creating library file: debug\libEngineQt.a
> ./debug\QtScreen.o: In function `ZN3Engine2QT7Graphic6ScreenC2Ev':
> D:/Development/Qt/SDK/Source/platform/qt/QtScreen.cpp:31: undefined
> reference to `vtable for Engine::QT::Graphic::Screen'
> D:/Development/Qt/SDK/Source/platform/qt/QtScreen.cpp:31: undefined
> reference to `vtable for Engine::QT::Graphic::Screen'
> D:/Development/Qt/SDK/Source/platform/qt/QtScreen.cpp:31: undefined
> reference to `vtable for Engine::QT::Graphic::Screen'
> ./debug\QtScreen.o: In function `ZN3Engine2QT7Graphic6ScreenC1Ev':
> D:/Development/Qt/SDK/Source/platform/qt/QtScreen.cpp:31: undefined
> reference to `vtable for Engine::QT::Graphic::Screen'
> D:/Development/Qt/SDK/Source/platform/qt/QtScreen.cpp:31: undefined
> reference to `vtable for Engine::QT::Graphic::Screen'
> ./debug\QtScreen.o:D:/Development/Qt/SDK/Source/platform/qt/QtScreen.cpp:31:
> more undefined references to `vtable for Engine::QT::Graphic::Screen'
> follow
> collect2: ld returned 1 exit status
> mingw32-make[1]: *** [debug\EngineQt.dll] Error 1
> mingw32-make: *** [debug] Error 2
> Exited with code 2.
> Error while building project Engine
> When executing build step 'Make'
>
> This specific class currently is declared this way:
>
> class Screen : public IScreen, public QGraphicsScene
> {
> Q_OBJECT // this causes the error....
>
> friend ...
>
> private:
> ...
>
> };
>
>
> Any suggestions?
>
>
>
--
Bill King, Software Engineer
Qt Software, Nokia Pty Ltd
Brisbane Office
More information about the Qt-interest-old
mailing list