PDA

View Full Version : Getting Linker error on Visual C++



samgoud_b
31st March 2008, 10:50
Hi,

I have recently installed QT on windows.
I am trying to build SvgViewer example came along with the installation using Visual studio C++.

Doing so, I am getting the following Linker errors:


mainwindow.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall MainWindow::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@MainWindow@@UAEHW4Call@QMetaObject@@ HPAPAX@Z)
mainwindow.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall MainWindow::qt_metacast(char const *)" (?qt_metacast@MainWindow@@UAEPAXPBD@Z)
mainwindow.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall MainWindow::metaObject(void)const " (?metaObject@MainWindow@@UBEPBUQMetaObject@@XZ)
mainwindow.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const MainWindow::staticMetaObject" (?staticMetaObject@MainWindow@@2UQMetaObject@@B)
svgview.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall SvgRasterView::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@SvgRasterView@@UAEHW4Call@QMetaObjec t@@HPAPAX@Z)
svgview.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall SvgRasterView::qt_metacast(char const *)" (?qt_metacast@SvgRasterView@@UAEPAXPBD@Z)
svgview.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall SvgRasterView::metaObject(void)const " (?metaObject@SvgRasterView@@UBEPBUQMetaObject@@XZ)
svgview.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall SvgNativeView::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@SvgNativeView@@UAEHW4Call@QMetaObjec t@@HPAPAX@Z)
svgview.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall SvgNativeView::qt_metacast(char const *)" (?qt_metacast@SvgNativeView@@UAEPAXPBD@Z)
svgview.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall SvgNativeView::metaObject(void)const " (?metaObject@SvgNativeView@@UBEPBUQMetaObject@@XZ)
svgview.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall SvgGLView::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@SvgGLView@@UAEHW4Call@QMetaObject@@H PAPAX@Z)
svgview.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall SvgGLView::qt_metacast(char const *)" (?qt_metacast@SvgGLView@@UAEPAXPBD@Z)
svgview.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall SvgGLView::metaObject(void)const " (?metaObject@SvgGLView@@UBEPBUQMetaObject@@XZ)
svgwindow.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const SvgGLView::staticMetaObject" (?staticMetaObject@SvgGLView@@2UQMetaObject@@B)
Debug/svgviewer.exe : fatal error LNK1120: 14 unresolved externals
Error executing link.exe.


Can nyone help me to solve these errors?

Thanks in advance,
Sampath

jpn
31st March 2008, 10:54
Are you using a commercial version with Visual Studio integration or did you generate the Visual Studio project on the command line yourself?

samgoud_b
31st March 2008, 11:01
I did not get your question...

Anyways,
I have installed commercial version of QT.
I have taken the source files from SVGViewer example and created a Visual c++ project (dsw, dsp files).

Is this what you have asked?

jpn
31st March 2008, 11:30
I have taken the source files from SVGViewer example and created a Visual c++ project (dsw, dsp files).
My question was that HOW did you create the Visual Studio project file? It's missing a custom build step for moc (http://doc.trolltech.com/4.3/moc.html).

samgoud_b
1st April 2008, 00:07
Can you let me know how that needs to be done?

jpn
1st April 2008, 06:18
Could you first answer the questions? It makes a difference how you create the Visual Studio project.

richardander
28th December 2008, 08:30
JPN,

I have the similar problem. My VC project files were created with qmake -tp vp project.pro

could you let me know how to solve this link problem?

thank you!

jpn
28th December 2008, 12:09
I have the similar problem. My VC project files were created with qmake -tp vp project.pro

could you let me know how to solve this link problem?
Hi, re-run "qmake -tp vc" always after adding or removing the Q_OBJECT macro.