Results 1 to 2 of 2

Thread: please help with linker errors

  1. #1
    Join Date
    Jul 2007
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question please help with linker errors

    Hi all,

    I'm fairly new to Qt. I'm trying to compile my example plugin and I'm getting the following linker errors: -

    release\exampleimportplugin.o(.text+0x4f):examplei mportplugin.cpp: undefined reference to `CPIImportImplementation::signal_newStep(unsigned int)'
    release\exampleimportplugin.o(.text+0x81):examplei mportplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
    release\exampleimportplugin.o(.text+0xda):examplei mportplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
    release\exampleimportplugin.o(.text+0x114):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newStep(unsigned int)'
    release\exampleimportplugin.o(.text+0x146):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
    release\exampleimportplugin.o(.text+0x19f):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
    release\exampleimportplugin.o(.text+0x1f8):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
    release\exampleimportplugin.o(.text+0x237):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newStep(unsigned int)'
    release\exampleimportplugin.o(.text+0x264):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
    release\exampleimportplugin.o(.text+0x2bd):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
    release\exampleimportplugin.o(.text+0x316):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
    release\exampleimportplugin.o(.text+0x36f):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
    release\exampleimportplugin.o(.text+0x600):example importplugin.cpp: undefined reference to `vtable for CPIImportImplementation'
    release\exampleimportplugin.o(.text+0xf0e):example importplugin.cpp: undefined reference to `vtable for CPIImportImplementation'
    release\exampleimportplugin.o(.text+0x1420):exampl eimportplugin.cpp: undefined reference to `vtable for CPIImportImplementation'
    release\exampleimportplugin.o(.text+0x1d2e):exampl eimportplugin.cpp: undefined reference to `vtable for CPIImportImplementation'
    release\moc_exampleimportplugin.o(.text+0xe2):moc_ exampleimportplugin.cpp: undefined reference to `CPIImportImplementation::qt_metacall(QMetaObject: :Call, int, void**)'
    release\moc_exampleimportplugin.o(.text+0x9d):moc_ exampleimportplugin.cpp: undefined reference to `CPIImportImplementation::qt_metacast(char const*)'
    release\moc_exampleimportplugin.o(.rdata+0x0):moc_ exampleimportplugin.cpp: undefined reference to `CPIImportImplementation::staticMetaObject'
    release\moc_exampleimportplugin.o(.text$_ZN19Examp leImportPluginD1Ev[ExampleImportPlugin::~ExampleImportPlugin()]+0x183):moc_exampleimportplugin.cpp: undefined reference to `vtable for CPIImportImplem
    entation'
    release\moc_exampleimportplugin.o(.text$_ZN19Examp leImportPluginD1Ev[ExampleImportPlugin::~ExampleImportPlugin()]+0x39c):moc_exampleimportplugin.cpp: undefined reference to `vtable for CPIImportImplem
    entation'
    release\moc_exampleimportplugin.o(.text$_ZN19Examp leImportPluginD0Ev[ExampleImportPlugin::~ExampleImportPlugin()]+0x183):moc_exampleimportplugin.cpp: undefined reference to `vtable for CPIImportImplem
    entation'
    release\moc_exampleimportplugin.o(.text$_ZN19Examp leImportPluginD0Ev[ExampleImportPlugin::~ExampleImportPlugin()]+0x3ac):moc_exampleimportplugin.cpp: undefined reference to `vtable for CPIImportImplem
    entation'
    collect2: ld returned 1 exit status
    I've cleaned the project, then I'm using qmake, then mingw32-make. Here's my .pro file:

    Qt Code:
    1. TEMPLATE = lib
    2. CONFIG += plugin
    3. TARGET = example
    4. DESTDIR = ../../../../bin/importers
    5. DEPENDPATH += .
    6. INCLUDEPATH += ../../../../include
    7.  
    8. # Input
    9. HEADERS += exampleimportplugin.h
    10. SOURCES += exampleimportplugin.cpp
    To copy to clipboard, switch view to plain text mode 

    Here's the code:

    ExampleImportPlugin.h:
    Qt Code:
    1. #include <QtPlugin>
    2. #include <CPIImportDescriptor.h> // in include path
    3. #include <CPIImportImplementation.h> // in include path
    4.  
    5. class ExampleImportPlugin : public CPIImportDescriptor, public CPIImportImplementation
    6. {
    7. Q_OBJECT
    8. Q_INTERFACES(CPIImportDescriptor CPIImportImplementation)
    9. public:
    10. ...
    11. private:
    12. ...
    13. };
    To copy to clipboard, switch view to plain text mode 

    ExampleImportPlugin.cpp:

    Qt Code:
    1. #include "exampleimportplugin.h"
    2.  
    3. ExampleImportPlugin::ExampleImportPlugin()
    4. {
    5. ...
    6. }
    7.  
    8. bool ExampleImportPlugin::go()
    9. {
    10. ...
    11. }
    12.  
    13. Q_EXPORT_PLUGIN2( example, ExampleImportPlugin );
    To copy to clipboard, switch view to plain text mode 

    CPIImportImplementation.h:
    Qt Code:
    1. #include <QObject>
    2. #include <QList>
    3. #include <QString>
    4.  
    5. class CPIImportImplementation : public QObject
    6. {
    7. Q_OBJECT
    8. public:
    9. CPIImportImplementation()
    10. : myIsCancelled( false )
    11. {
    12. }
    13. virtual bool go() = 0;
    14. virtual ~CPIImportImplementation() {}
    15.  
    16. bool isCancelled() { return myIsCancelled; }
    17. QString status() { return myStatus; }
    18. QList<QString> & steps() { return mySteps; }
    19.  
    20. public slots:
    21. void slot_cancelled() { myIsCancelled = true; }
    22.  
    23. signals:
    24. void signal_newStep( const unsigned int numSubSteps );
    25. void signal_setStep( const unsigned int step, const unsigned int numSubSteps );
    26. void signal_newSubStep( const QString & status );
    27. void signal_setSubStep( const unsigned int step, const QString & status );
    28. protected:
    29. QList<QString> mySteps;
    30. QString myStatus;
    31. private:
    32. bool myIsCancelled;
    33. };
    34.  
    35. Q_DECLARE_INTERFACE( CPIImportImplementation, "co.uk.cabos.Plugin.CPIImportImplementation/1.0" );
    To copy to clipboard, switch view to plain text mode 

    CPIImportDescriptor.h:
    Qt Code:
    1. #include <QObject>
    2.  
    3. class CPIImportDescriptor
    4. {
    5. public:
    6. ...
    7. protected:
    8. ...
    9. private:
    10. ...
    11. };
    12.  
    13. Q_DECLARE_INTERFACE( CPIImportDescriptor, "CABOS.Plugin.CPIImportDescriptor/1.0" );
    To copy to clipboard, switch view to plain text mode 


    Any ideas what I'm doing wrong?

    Many thanks,

    jimbo
    Last edited by jacek; 5th July 2007 at 15:31. Reason: changed [code] to [quote]

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: please help with linker errors

    You forgot to include CPIImportImplementation.h in your .pro file. Therefore it is not moced and the meta object for it is not created.

  3. The following user says thank you to wysota for this useful post:

    jimboqt (5th July 2007)

Similar Threads

  1. Example QtUiTools linker error
    By phillies in forum Newbie
    Replies: 1
    Last Post: 26th June 2007, 21:27
  2. Qt Compile Errors?
    By magikalpnoi in forum Qt Programming
    Replies: 4
    Last Post: 14th September 2006, 22:18
  3. Linker errors!!
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 25th April 2006, 08:14
  4. Linker Errors
    By MarkoSan in forum Qt Programming
    Replies: 5
    Last Post: 7th March 2006, 18:30
  5. Qt 4.1.0 - static examples run with errors!
    By Elder Orb in forum Qt Programming
    Replies: 1
    Last Post: 12th January 2006, 09:40

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.