Results 1 to 10 of 10

Thread: Qt 4.6 with VS 2008 Express: Linker error when building libraries

  1. #1
    Join Date
    Jan 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Qt 4.6 with VS 2008 Express: Linker error when building libraries

    Hi,
    I want to use QT4.6 with VS 2008 Express.
    I have roughly followed this guide: http://netindonesia.net/blogs/risman...c-express.aspx
    I have downloaded and installed Qt libraries 4.6 for Windows (VS 2008, 190 MB, http://qt.nokia.com/downloads/windows-cpp-vs2008)
    Then i opened a VS2008 Command Prompt and typed:
    configure -platform win32-msvc2008
    =>OK
    nmake
    =>gives the following linker error:
    Generating Code...
    link /NOLOGO /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /MANIFEST /MANIFESTFILE:
    "release\moc.intermediate.manifest" /OUT:..\..\..\bin\moc.exe @C:\DOCUME~1\Max\LOCALS~1\Temp\nm92.tmp
    bootstrap.lib(qbytearray.obj) : error LNK2019: unresolved external symbol _uncompress referenced in function "class QByteArray __cdecl qUncompress(unsigned char const *,int)" (?qUncompress@@YA?AVQByteArray@@PBEH@Z)
    bootstrap.lib(qbytearray.obj) : error LNK2019: unresolved external symbol _compress2 referenced in function "class QByteArray __cdecl qCompress(unsigned char const *,int,int)" (?qCompress@@YA?AVQByteArray@@PBEHH@Z)
    ..\..\..\bin\moc.exe : fatal error LNK1120: 2 unresolved externals

    Any hints on this?
    It seems the functions mentioned are part of zlib?
    Do i need to install zlib seperately? From where and how?
    Any help will be much appreciated.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries

    Why not just download the VS2008 version of Qt from Nokia's website?

  3. #3
    Join Date
    Jan 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries

    That's what i did.
    I tried with both the source- and SDK distribution.
    Same issue.

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries

    Ok, I'm confused. Is there a reason you want to reconfigure/rebuild the library when they have already been made for you?

  5. #5
    Join Date
    Jan 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries

    Well, isn't this what the official deployment guide for Windows (http://doc.qt.nokia.com/4.6/install-win.html) suggests to do?

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries

    If you want to configure the suite differently for deployment (ie, you want to disable some stuff perhaps) then yes, thats correct. But from your first post you just want the standard version, which has already been done for you.

  7. #7
    Join Date
    Jan 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries

    Ok, so i tried using the pre-built libs.
    I can compile an example (calculator), but i get linker errors.
    I have added the Qt/4.6.0/lib diretcory to the VS2008 Linker lib path, but that doesn't seem to be sufficient.
    Any clues?

  8. #8
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries

    Normally you would let the Qt plugin for VS do all the work for you, but since you are using an express edition, you can't do that. So you need to figure out your project dependancies and add them to your project linker section. These will be things like QtCore, QtGUI, and so on.

    You can probably use QMake to generate an appropriate project file for you - create the .PRO file either yourself or using QtCreator and then change the platform configuration.

  9. #9
    Join Date
    Jan 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries

    Ok, i now have added all Qt lib files to the project and this reduced the number of unresolved symbols.
    There are still these though:
    1>button.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall Button::metaObject(void)const " (?metaObject@Button@@UBEPBUQMetaObject@@XZ)
    1>button.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall Button::qt_metacast(char const *)" (?qt_metacast@Button@@UAEPAXPBD@Z)
    1>button.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Button::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@Button@@UAEHW4Call@QMetaObject@@HPAP AX@Z)
    1>calculator.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall Calculator::metaObject(void)const " (?metaObject@Calculator@@UBEPBUQMetaObject@@XZ)
    1>calculator.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall Calculator::qt_metacast(char const *)" (?qt_metacast@Calculator@@UAEPAXPBD@Z)
    1>calculator.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Calculator::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@Calculator@@UAEHW4Call@QMetaObject@@ HPAPAX@Z)
    1>calculator.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const Calculator::staticMetaObject" (?staticMetaObject@Calculator@@2UQMetaObject@@B)
    1>calculator.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const Button::staticMetaObject" (?staticMetaObject@Button@@2UQMetaObject@@B)
    1>D:\Dev\calculator\Debug\calculator.exe : fatal error LNK1120: 8 unresolved externals

    Any ideas?

  10. #10
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries

    Yes, you need to run MOC on the appropriate header files and include the resulting output in your project. The plugin typically associates MOC with the header files for you so it's run whenever the header files are updated. You'll have to do this manually since you don't have the plugin.

Similar Threads

  1. QT 4.4 setup help with VC++ 2008 Express
    By Chronos in forum Installation and Deployment
    Replies: 5
    Last Post: 21st July 2009, 19:40
  2. Linker error while building with a makefile
    By kamleshwark in forum Newbie
    Replies: 1
    Last Post: 17th July 2009, 23:06
  3. Qt 4.5.0 vs MSVS 2008 Express Edition
    By Rainstorm in forum Installation and Deployment
    Replies: 5
    Last Post: 21st March 2009, 00:11
  4. msvc++ 2008 express and msvc++ 2005 express
    By vonCZ in forum Installation and Deployment
    Replies: 4
    Last Post: 9th December 2008, 12:15
  5. Qt 4.4.1 Compile Error with MS Visual C++ 2008 Express SP1
    By BrainB0ne in forum Installation and Deployment
    Replies: 3
    Last Post: 19th August 2008, 15:49

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.