Results 1 to 10 of 10

Thread: link error for visual studio.net 2003

  1. #1

    Default link error for visual studio.net 2003

    I compile one application using visual studio. net 2003. But, there are always some linking errors when I complile this application. How to deal with it? I am a newer for QT programming.

    The following is the errors.

    ------ Build started: Project: OpenMesh_Apps_Decimating, Configuration: Debug Win32 ------

    Linking...
    progviewer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall ProgViewerWidget::qt_property(int,int,class QVariant *)" (?qt_property@ProgViewerWidget@@UAE_NHHPAVQVariant @@@Z)
    progviewer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall ProgViewerWidget::qt_emit(int,struct QUObject *)" (?qt_emit@ProgViewerWidget@@UAE_NHPAUQUObject@@@Z)
    progviewer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall ProgViewerWidget::qt_invoke(int,struct QUObject *)" (?qt_invoke@ProgViewerWidget@@UAE_NHPAUQUObject@@@ Z)
    progviewer.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall ProgViewerWidget::qt_cast(char const *)" (?qt_cast@ProgViewerWidget@@UAEPAXPBD@Z)
    progviewer.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall ProgViewerWidget::className(void)const " (?className@ProgViewerWidget@@UBEPBDXZ)
    progviewer.obj : error LNK2019: unresolved external symbol "public: static class QMetaObject * __cdecl ProgViewerWidget::staticMetaObject(void)" (?staticMetaObject@ProgViewerWidget@@SAPAVQMetaObj ect@@XZ) referenced in function "public: virtual class QMetaObject * __thiscall ProgViewerWidget::metaObject(void)const " (?metaObject@ProgViewerWidget@@UBEPAVQMetaObject@@ XZ)
    progviewer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QGLViewerWidget::qt_property(int,int,class QVariant *)" (?qt_property@QGLViewerWidget@@UAE_NHHPAVQVariant@ @@Z)
    QGLViewerWidget.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QGLViewerWidget::qt_property(int,int,class QVariant *)" (?qt_property@QGLViewerWidget@@UAE_NHHPAVQVariant@ @@Z)
    progviewer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QGLViewerWidget::qt_emit(int,struct QUObject *)" (?qt_emit@QGLViewerWidget@@UAE_NHPAUQUObject@@@Z)
    QGLViewerWidget.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QGLViewerWidget::qt_emit(int,struct QUObject *)" (?qt_emit@QGLViewerWidget@@UAE_NHPAUQUObject@@@Z)
    progviewer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QGLViewerWidget::qt_invoke(int,struct QUObject *)" (?qt_invoke@QGLViewerWidget@@UAE_NHPAUQUObject@@@Z )
    QGLViewerWidget.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QGLViewerWidget::qt_invoke(int,struct QUObject *)" (?qt_invoke@QGLViewerWidget@@UAE_NHPAUQUObject@@@Z )
    progviewer.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QGLViewerWidget::qt_cast(char const *)" (?qt_cast@QGLViewerWidget@@UAEPAXPBD@Z)
    QGLViewerWidget.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QGLViewerWidget::qt_cast(char const *)" (?qt_cast@QGLViewerWidget@@UAEPAXPBD@Z)
    progviewer.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall QGLViewerWidget::className(void)const " (?className@QGLViewerWidget@@UBEPBDXZ)
    QGLViewerWidget.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall QGLViewerWidget::className(void)const " (?className@QGLViewerWidget@@UBEPBDXZ)
    progviewer.obj : error LNK2019: unresolved external symbol "public: static class QMetaObject * __cdecl QGLViewerWidget::staticMetaObject(void)" (?staticMetaObject@QGLViewerWidget@@SAPAVQMetaObje ct@@XZ) referenced in function "public: virtual class QMetaObject * __thiscall QGLViewerWidget::metaObject(void)const " (?metaObject@QGLViewerWidget@@UBEPAVQMetaObject@@X Z)
    QGLViewerWidget.obj : error LNK2019: unresolved external symbol "public: static class QMetaObject * __cdecl QGLViewerWidget::staticMetaObject(void)" (?staticMetaObject@QGLViewerWidget@@SAPAVQMetaObje ct@@XZ) referenced in function "protected: double __thiscall QGLViewerWidget:erformance(void)" (?performance@QGLViewerWidget@@IAENXZ)
    Debug/Decimating.exe : fatal error LNK1120: 12 unresolved externals

    Build log was saved at "file://d:\My Documents\Software\OpenMesh_1.9.3\OpenMesh\Apps\De cimating\Debug\BuildLog.htm"
    OpenMesh_Apps_Decimating - 19 error(s), 0 warning(s)


    ---------------------- Done ----------------------

    Build: 0 succeeded, 1 failed, 0 skipped

  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: link error for visual studio.net 2003

    Did you remember to put the Q_OBJECT macro in header of your class and rerun qmake?

  3. #3

    Default Re: link error for visual studio.net 2003

    Thank you very much!
    I just compile my application by visual studio .net 2003 IDE. I am sorry I am a newer to the QT. I don't know how to deal with it.

    If I just want to use the visual studio .net 2003 IDE to complie and build my application successfuly, then what I should do in detail?

    Thank you very much!

  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: link error for visual studio.net 2003

    You can start by reading the docs.

  5. #5

    Default Re: link error for visual studio.net 2003

    Thank you very much!
    But I do not find the moc-file in my generated files.

    Also, in the .h files, the macro Q_OBJECT has been included.
    Now, I just build the .cpp files in the vs.net 2003 IDE.

    Could you tell me how to generate the moc-files and be included in the vs.net 2003 IDE?


    Thanks again!

  6. #6
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: link error for visual studio.net 2003

    Have you installed the Qt VS intergration ?

    In the toolbar you will find hte moc button.
    Open the header file and moc this using that Button.

    you will find that a new file moc_HeaderFile.cpp added to the project
    Now compile
    We can't solve problems by using the same kind of thinking we used when we created them

  7. #7
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: link error for visual studio.net 2003

    Use qmake to create your makefiles. Build rules for moc will be included and moc will be run when required, so that you will not need to use the moc directly. If you are using a commercial edition, you should have the VS integration package, otherwise see this post.
    J-P Nurmi

  8. #8

    Default Re: link error for visual studio.net 2003

    Thank all !

    I have set up this qt version --- qt-win-free-msvc.net2003-3.3.4 . What's more, I don't find the moc button in my toolbar?
    As you said, I could only compile the source by qmake?
    COuld I compile the .hh file with moc exe firstly and include the moc---.cpp file in my .cpp file?

    Is it ok?

    Thanks again!

  9. #9
    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: link error for visual studio.net 2003

    Ah... you're using the unsupported version. So you won't get the integration and you should either correct your build configuration to include moc files or use qmake to generate makefiles and simplify the build configuration to only call nmake.

  10. #10

    Default Re: link error for visual studio.net 2003

    Thank you very much! I have dealt with it correctly!

    Thanks all again!

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.