Results 1 to 6 of 6

Thread: Link errors when linking chained libraries on windows

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanked 86 Times in 81 Posts

    Default Re: Link errors when linking chained libraries on windows

    You're probably using MYLIB define for both libs. That's wrong. Use a more specific define to distinguish between the two libs.

    btw: no need to put a #ifdef Q_OS_WIN32 around - this works fine for Linux and others too

  2. #2
    Join Date
    May 2006
    Posts
    70
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    12
    Thanked 4 Times in 2 Posts

    Default Re: Link errors when linking chained libraries on windows

    Yeah that's exactly what I was doing. Since I didn't find the info anywhere else on the web I figured I'd share it here.

    It seems like 90% of the bugs I run into are obvious forehead slappers.

  3. #3
    Join Date
    Apr 2008
    Location
    California
    Posts
    25
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    2

    Default Re: Link errors when linking chained libraries on windows

    Hello,

    I didn't understand the solution very well here but I'm having the same issue that was discussed in this thread.

    My app is developed using QT 4.3.1 commerical/ VS 2005. Everything works great when build from VS 2005. Now I want to deploy/ distribute the app to other systems. So I did read the deploy document on trolltech and followed these steps:

    opened the QT command prompt...
    cmd> nmake clean (no errors)
    cmd> qmake -config release (no errors)
    cmd> nmake ---- lots of LNK2019 errors

    I'm copying partial error output here:
    Qt Code:
    1. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    2. blic: bool __thiscall QDomDocument::setContent(class QIODevice *,class QString *
    3. ,int *,int *)" (__imp_?setContent@QDomDocument@@QAE_NPAVQIODevice@@PAVQString@@P
    4. AH2@Z) referenced in function "private: void __thiscall snipit::checkOptions(voi
    5. d)" (?checkOptions@snipit@@AAEXXZ)
    6. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    7. blic: __thiscall QDomNode::~QDomNode(void)" (__imp_??1QDomNode@@QAE@XZ) referenc
    8. ed in function "private: void __thiscall snipit::checkOptions(void)" (?checkOpti
    9. ons@snipit@@AAEXXZ)
    10. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    11. blic: __thiscall QDomDocument::QDomDocument(class QString const &)" (__imp_??0QD
    12. omDocument@@QAE@ABVQString@@@Z) referenced in function "private: void __thiscall
    13. snipit::checkOptions(void)" (?checkOptions@snipit@@AAEXXZ)
    14. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    15. blic: class QDomNode __thiscall QDomNode::appendChild(class QDomNode const &)" (
    16. __imp_?appendChild@QDomNode@@QAE?AV1@ABV1@@Z) referenced in function "private: v
    17. oid __thiscall snipit::checkOptions(void)" (?checkOptions@snipit@@AAEXXZ)
    18. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    19. blic: class QDomElement __thiscall QDomDocument::createElement(class QString con
    20. st &)" (__imp_?createElement@QDomDocument@@QAE?AVQDomElement@@ABVQString@@@Z) re
    21. ferenced in function "private: void __thiscall snipit::checkOptions(void)" (?che
    22. ckOptions@snipit@@AAEXXZ)
    23. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    24. blic: class QString __thiscall QHttpResponseHeader::reasonPhrase(void)const " (_
    25. _imp_?reasonPhrase@QHttpResponseHeader@@QBE?AVQString@@XZ) referenced in functio
    26. n "private: void __thiscall snipit::readResponseHeaderFilePosted(class QHttpResp
    27. onseHeader const &)" (?readResponseHeaderFilePosted@snipit@@AAEXABVQHttpResponse
    28. Header@@@Z)
    29. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    30. blic: int __thiscall QHttpResponseHeader::statusCode(void)const " (__imp_?status
    31. Code@QHttpResponseHeader@@QBEHXZ) referenced in function "private: void __thisca
    32. ll snipit::readResponseHeaderFilePosted(class QHttpResponseHeader const &)" (?re
    33. adResponseHeaderFilePosted@snipit@@AAEXABVQHttpResponseHeader@@@Z)
    34. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    35. blic: class QDomElement __thiscall QDomNode::toElement(void)const " (__imp_?toEl
    36. ement@QDomNode@@QBE?AVQDomElement@@XZ) referenced in function "private: void __t
    37. hiscall snipit::readyReadFile(class QHttpResponseHeader const &)" (?readyReadFil
    38. e@snipit@@AAEXABVQHttpResponseHeader@@@Z)
    39. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    40. blic: class QDomNode __thiscall QDomNodeList::item(int)const " (__imp_?item@QDom
    41. NodeList@@QBE?AVQDomNode@@H@Z) referenced in function "private: void __thiscall
    42. snipit::readyReadFile(class QHttpResponseHeader const &)" (?readyReadFile@snipit
    43. @@AAEXABVQHttpResponseHeader@@@Z)
    44. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    45. blic: class QDomNodeList & __thiscall QDomNodeList::operator=(class QDomNodeList
    46. const &)" (__imp_??4QDomNodeList@@QAEAAV0@ABV0@@Z) referenced in function "priv
    47. ate: void __thiscall snipit::readyReadFile(class QHttpResponseHeader const &)" (
    48. ?readyReadFile@snipit@@AAEXABVQHttpResponseHeader@@@Z)
    49. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    50. blic: __thiscall QDomNodeList::~QDomNodeList(void)" (__imp_??1QDomNodeList@@QAE@
    51. XZ) referenced in function "private: void __thiscall snipit::readyReadFile(class
    52. QHttpResponseHeader const &)" (?readyReadFile@snipit@@AAEXABVQHttpResponseHeade
    53. r@@@Z)
    54. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    55. blic: unsigned int __thiscall QDomNodeList::length(void)const " (__imp_?length@Q
    56. DomNodeList@@QBEIXZ) referenced in function "private: void __thiscall snipit::re
    57. adyReadFile(class QHttpResponseHeader const &)" (?readyReadFile@snipit@@AAEXABVQ
    58. HttpResponseHeader@@@Z)
    59. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    60. blic: class QDomNodeList __thiscall QDomElement::elementsByTagName(class QString
    61. const &)const " (__imp_?elementsByTagName@QDomElement@@QBE?AVQDomNodeList@@ABVQ
    62. String@@@Z) referenced in function "private: void __thiscall snipit::readyReadFi
    63. le(class QHttpResponseHeader const &)" (?readyReadFile@snipit@@AAEXABVQHttpRespo
    64. nseHeader@@@Z)
    65. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    66. blic: __thiscall QDomNode::QDomNode(void)" (__imp_??0QDomNode@@QAE@XZ) reference
    67. d in function "private: void __thiscall snipit::readyReadFile(class QHttpRespons
    68. eHeader const &)" (?readyReadFile@snipit@@AAEXABVQHttpResponseHeader@@@Z)
    69. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    70. blic: __thiscall QDomNodeList::QDomNodeList(void)" (__imp_??0QDomNodeList@@QAE@X
    71. Z) referenced in function "private: void __thiscall snipit::readyReadFile(class
    72. QHttpResponseHeader const &)" (?readyReadFile@snipit@@AAEXABVQHttpResponseHeader
    73. @@@Z)
    74. snipit.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
    75. blic: class QByteArray __thiscall QHttp::readAll(void)" (__imp_?readAll@QHttp@@Q
    76. AE?AVQByteArray@@XZ) referenced in function "private: void __thiscall snipit::re
    77. adyReadFile(class QHttpResponseHeader const &)" (?readyReadFile@snipit@@AAEXABVQ
    78. HttpResponseHeader@@@Z)
    79. release\snipit.exe : fatal error LNK1120: 40 unresolved externals
    80. NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\l
    81. ink.EXE"' : return code '0x460'
    82. Stop.
    83. NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\n
    84. make.exe"' : return code '0x2'
    85. Stop.
    To copy to clipboard, switch view to plain text mode 

    what am I doing wrong here or how can I resolve the issue I'm having?

    thanks in advance.
    - AR

  4. #4
    Join Date
    May 2006
    Posts
    70
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    12
    Thanked 4 Times in 2 Posts

    Default Re: Link errors when linking chained libraries on windows

    It looks like a different problem then the one I posted about. It looks like you forgot to include the XML and Network modules in your .pro file.

    QT += xml \
    network

    You can tell this because your linker is missing the QDomDocument::setContent() and QHttpResponseHeader::reasonPhrase() methods amoong others.

  5. The following user says thank you to darkadept for this useful post:

    arunredi (26th May 2008)

  6. #5
    Join Date
    Apr 2008
    Location
    California
    Posts
    25
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    2

    Default Re: Link errors when linking chained libraries on windows

    you were right. All those errors got resolved after adding the line into my .pro file. thank you.
    - AR

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.