Results 1 to 8 of 8

Thread: Getting Linker error on Visual C++

  1. #1

    Default Getting Linker error on Visual C++

    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
    Last edited by jpn; 31st March 2008 at 10:52. Reason: missing [quote] tags

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

    Default Re: Getting Linker error on Visual C++

    Are you using a commercial version with Visual Studio integration or did you generate the Visual Studio project on the command line yourself?
    J-P Nurmi

  3. #3

    Default Re: Getting Linker error on Visual C++

    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?

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

    Default Re: Getting Linker error on Visual C++

    Quote Originally Posted by samgoud_b View Post
    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.
    J-P Nurmi

  5. #5

    Default Re: Getting Linker error on Visual C++

    Can you let me know how that needs to be done?

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

    Default Re: Getting Linker error on Visual C++

    Could you first answer the questions? It makes a difference how you create the Visual Studio project.
    J-P Nurmi

  7. #7
    Join Date
    Dec 2008
    Posts
    68

    Default Re: Getting Linker error on Visual C++

    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!

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

    Default Re: Getting Linker error on Visual C++

    Quote Originally Posted by richardander View Post
    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.
    J-P Nurmi

  9. The following user says thank you to jpn for this useful post:

    mentalmushroom (28th March 2012)

Similar Threads

  1. MS Visual C++ Linker warnings
    By YuriyRusinov in forum Qt Programming
    Replies: 9
    Last Post: 6th December 2007, 08:07
  2. Qt configure with msvc.net
    By jivanr in forum Installation and Deployment
    Replies: 1
    Last Post: 11th June 2007, 08:17
  3. Compile App using OpenGL and Visual Studios 2003
    By Rayven in forum General Programming
    Replies: 3
    Last Post: 26th April 2007, 15:43
  4. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15
  5. problem with linking
    By mickey in forum Qt Programming
    Replies: 49
    Last Post: 12th August 2006, 21:41

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
  •  
Qt is a trademark of The Qt Company.