PDA

View Full Version : link error for visual studio.net 2003



berlin
29th September 2006, 07:37
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::performance(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

wysota
29th September 2006, 08:15
Did you remember to put the Q_OBJECT macro in header of your class and rerun qmake?

berlin
29th September 2006, 09:41
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!

wysota
29th September 2006, 09:57
You can start by reading the docs (http://doc.trolltech.com/4.2/qobject.html#Q_OBJECT).

berlin
29th September 2006, 12:43
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!

sunil.thaha
29th September 2006, 12:53
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

jpn
29th September 2006, 12:54
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 (http://www.qtcentre.org/forum/f-qt-programming-2/t-cannot-compile-the-mainwindow-example-with-vs2005-3485.html#4).

berlin
29th September 2006, 13:08
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!

wysota
29th September 2006, 14:28
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.

berlin
29th September 2006, 16:06
Thank you very much! I have dealt with it correctly!

Thanks all again!