[Qt-interest] Problem porting software to QT
fungos
fungos at gmail.com
Thu Apr 9 06:03:58 CEST 2009
Sorry. I'm using latest QtCreator. I created a library ("TEMPLATE =
lib") project and then "added existing files" to it. The project.pro
file has all my files HEADERS and SOURCES. Note, my headers are in a
separate directory, so I also have this: "INCLUDEPATH += include/."
On Thu, Apr 9, 2009 at 12:56 AM, Karol Krizka <kkrizka at gmail.com> wrote:
> On Wed, Apr 8, 2009 at 8:46 PM, fungos <fungos at gmail.com> 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'
>>
>
> What are you using to create the Makefile? If you are using the
> Q_OBJECT macro, I think you need to first compile the header with one
> of Qt's custom preprocessors like moc. If you use qmake to create the
> Makefile, then this is handled automatically as long as you add the
> header to the HEADERS variable. Just make sure to rerun qmake after
> you edit it.
>
> --
> Cheers,
> Karol Krizka
> http://www.krizka.net
>
>> This specific class currently is declared this way:
>>
>> class Screen : public IScreen, public QGraphicsScene
>> {
>> Q_OBJECT // this causes the error....
>>
>> friend ...
>>
>> private:
>> ...
>>
>> };
>>
>>
>> Any suggestions?
>>
>>
>> --
>> Animal Frontline Liberation
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
--
Animal Frontline Liberation
More information about the Qt-interest-old
mailing list