Results 1 to 5 of 5

Thread: Plotter

  1. #1
    Join Date
    Mar 2008
    Posts
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default Plotter

    Hi

    I am trying to get the plotter example from the book C++ GUI programming with QT 4 to
    work in my application. I am getting link errors and am not sure what is really causing it
    I am using Visual Studio C++ V8 QT V4.3 I have included the plotter.cpp and plotter.h files in my project and am just calling "Plotter plotter;" with no code to actualy use it yet, but I can't get past the link errors does anybody have any ideas? The exact error is.

    1>plotter.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall Plotter::metaObject(void)const " (?metaObject@Plotter@@UBEPBUQMetaObject@@XZ)
    1>plotter.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall Plotter::qt_metacast(char const *)" (?qt_metacast@Plotter@@UAEPAXPBD@Z)
    1>plotter.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Plotter::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@Plotter@@UAEHW4Call@QMetaObject@@HPA PAX@Z)
    1>C:\Documents and Settings\Chris Simpson\My Documents\Visual Studio 2005\Visual Studio Projects\WindowsINE\INE-DE\Debug\ine.exe : fatal error LNK1120: 3 unresolved externals
    1>Build log was saved at "file://c:\Documents and Settings\Chris Simpson\My Documents\Visual Studio 2005\Visual Studio Projects\WindowsINE\INE-DE\Debug\BuildLog.htm"
    1>INE-DT - 4 error(s), 2 warning(s)

  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: Plotter

    Looks like you forgot to rerun qmake after adding a Q_OBJECT macro to your class. Or forgot to call moc on the header and include moc_classname.cpp in the compilation in case you are not using qmake at all.

  3. #3
    Join Date
    Mar 2008
    Posts
    13
    Qt products
    Qt4
    Platforms
    Windows

    Talking Re: Plotter

    This is an application I have taken over coding I am new to QT. I have not used the moc_myclass.cpp. I guess I don't understand the interaction with it. There are about 10 files build with designer creating myclass.ui that have the assocated moc_myclass.cpp files.

    Thanks, Chris

  4. #4
    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: Plotter

    So you need to add the 11th to the build process... or use qmake and forget about all the problems.

  5. #5
    Join Date
    Mar 2008
    Posts
    13
    Qt products
    Qt4
    Platforms
    Windows

    Smile Re: Plotter

    OK I used the moc_plotter.cpp and got it to work corectly

    Thanks for the help

    Chris

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.