Results 1 to 10 of 10

Thread: Linking to a static library on Windows

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2008
    Posts
    142
    Thanks
    3
    Thanked 20 Times in 20 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Linking to a static library on Windows

    g++ 3.4.2 from the MinGW installed with Qt 4.5.1.

    The exact errors are:

    Qt Code:
    1. g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    2. oc -mthreads -Wl -Wl,-subsystem,windows -o ..\build\xmlrpc-client.exe debug/clie
    3. nt.o -L"c:\Qt\4.5.1\lib" -lmingw32 -lqtmaind -L../build -lxmlrpc -lQtCored4
    4. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x2a): In function `Z11initWinSockv':
    5.  
    6. C:/XmlRpc++/xmlrpc++/XmlRpcSocket.cpp:48: undefined reference to `WSAStartup@8'
    7. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x5d): In function `ZN6XmlRpc12XmlRpc
    8. Socket6socketEv':
    9. C:/XmlRpc++/xmlrpc++/XmlRpcSocket.cpp:83: undefined reference to `socket@12'
    10. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x8e): In function `ZN6XmlRpc12XmlRpc
    11. Socket5closeEi':
    12. C:/XmlRpc++/xmlrpc++/XmlRpcSocket.cpp:92: undefined reference to `closesocket@4'
    13.  
    14. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0xbc): In function `ZN6XmlRpc12XmlRpc
    15. Socket14setNonBlockingEi':
    16. C:/XmlRpc++/xmlrpc++/XmlRpcSocket.cpp:106: undefined reference to `ioctlsocket@1
    17. 2'
    18. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x10b): In function `ZN6XmlRpc12XmlRp
    19. cSocket12setReuseAddrEi':
    20. C:/XmlRpc++/xmlrpc++/XmlRpcSocket.cpp:118: undefined reference to `setsockopt@20
    21. '
    22. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x157): In function `ZN6XmlRpc12XmlRp
    23. cSocket4bindEii':
    24. C:/XmlRpc++/xmlrpc++/XmlRpcSocket.cpp:129: undefined reference to `htonl@4'
    25. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x16b):C:/XmlRpc++/xmlrpc++/XmlRpcSoc
    26. ket.cpp:130: undefined reference to `htons@4'
    27. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x18c):C:/XmlRpc++/xmlrpc++/XmlRpcSoc
    28. ket.cpp:131: undefined reference to `bind@12'
    29. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x1bc): In function `ZN6XmlRpc12XmlRp
    30. cSocket6listenEii':
    31. C:/XmlRpc++/xmlrpc++/XmlRpcSocket.cpp:139: undefined reference to `listen@8'
    32. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x1fa): In function `ZN6XmlRpc12XmlRp
    33. cSocket6acceptEi':
    34. C:/XmlRpc++/xmlrpc++/XmlRpcSocket.cpp:154: undefined reference to `accept@12'
    35. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x23a): In function `ZN6XmlRpc12XmlRp
    36. cSocket7connectEiRSsi':
    37. C:/XmlRpc++/xmlrpc++/XmlRpcSocket.cpp:167: undefined reference to `gethostbyname
    38. @4'
    39. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x290):C:/XmlRpc++/xmlrpc++/XmlRpcSoc
    40. ket.cpp:172: undefined reference to `htons@4'
    41. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x2b1):C:/XmlRpc++/xmlrpc++/XmlRpcSoc
    42. ket.cpp:176: undefined reference to `connect@12'
    43. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x389): In function `ZN6XmlRpc12XmlRp
    44. cSocket6nbReadEiRSsPb':
    45. C:/XmlRpc++/xmlrpc++/XmlRpcSocket.cpp:194: undefined reference to `recv@16'
    46. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x4a4): In function `ZN6XmlRpc12XmlRp
    47. cSocket7nbWriteEiRSsPi':
    48. C:/XmlRpc++/xmlrpc++/XmlRpcSocket.cpp:226: undefined reference to `send@16'
    49. ../build/libxmlrpc.a(XmlRpcSocket.o)(.text+0x51d): In function `ZN6XmlRpc12XmlRp
    50. cSocket8getErrorEv':
    51. C:/XmlRpc++/xmlrpc++/XmlRpcSocket.cpp:251: undefined reference to `WSAGetLastErr
    52. or@0'
    53. ../build/libxmlrpc.a(XmlRpcDispatch.o)(.text+0x6b3): In function `ZN6XmlRpc14Xml
    54. RpcDispatch4workEd':
    55. C:/XmlRpc++/xmlrpc++/XmlRpcDispatch.cpp:103: undefined reference to `select@20'
    56. ../build/libxmlrpc.a(XmlRpcDispatch.o)(.text+0x7b6):C:/XmlRpc++/xmlrpc++/XmlRpcD
    57. ispatch.cpp:109: undefined reference to `select@20'
    58. ../build/libxmlrpc.a(XmlRpcDispatch.o)(.text+0x8d6):C:/XmlRpc++/xmlrpc++/XmlRpcD
    59. ispatch.cpp:128: undefined reference to `__WSAFDIsSet@8'
    60. ../build/libxmlrpc.a(XmlRpcDispatch.o)(.text+0x929):C:/XmlRpc++/xmlrpc++/XmlRpcD
    61. ispatch.cpp:130: undefined reference to `__WSAFDIsSet@8'
    62. ../build/libxmlrpc.a(XmlRpcDispatch.o)(.text+0x97c):C:/XmlRpc++/xmlrpc++/XmlRpcD
    63. ispatch.cpp:132: undefined reference to `__WSAFDIsSet@8'
    64. collect2: ld returned 1 exit status
    65. mingw32-make[2]: *** [..\build\xmlrpc-client.exe] Error 1
    66. mingw32-make[2]: Leaving directory `C:/XmlRpc++/client'
    67. mingw32-make[1]: *** [debug] Error 2
    68. mingw32-make[1]: Leaving directory `C:/XmlRpc++/client'
    69. mingw32-make: *** [sub-client-make_default-ordered] Error 2
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linking to a static library on Windows

    Changes in the file : \XmlRpc++\xmlrp++\xmlrpc++.pro
    XmlRcpSource.h \
    XmlRcpUtil.h \
    XmlRcpValue.h
    on
    XmlRpcSource.h \
    XmlRpcUtil.h \
    XmlRpcValue.h
    PS: And to see that you display qmake - where it all clear

    Be careful!

  3. #3
    Join Date
    Nov 2008
    Posts
    142
    Thanks
    3
    Thanked 20 Times in 20 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Linking to a static library on Windows

    Thanks, that was a stupid typo. It doesn't change anything, though, the problem remains. The linking step still fails with the same error messages.

  4. #4
    Join Date
    Nov 2008
    Posts
    142
    Thanks
    3
    Thanked 20 Times in 20 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Linking to a static library on Windows

    Just for the record, in case anyone is interested in this: the problem was that, in addition to the static library I used, I also had to link against the Winsocks library which is used by said static library. Strange, but it solves the problem.

Similar Threads

  1. Extending a plugin in a static library
    By ultim8 in forum Qt Programming
    Replies: 5
    Last Post: 25th March 2010, 15:10
  2. Trouble linking static library
    By russdot in forum Qt Programming
    Replies: 3
    Last Post: 17th May 2009, 10:56
  3. Linking problems with QT4 under Windows
    By Ancalagon in forum Qt Programming
    Replies: 2
    Last Post: 8th September 2008, 13:29
  4. Qt 4.3 static linking on Windows
    By john_crichton in forum Installation and Deployment
    Replies: 2
    Last Post: 13th May 2008, 06:57
  5. Please Help-->have few doubts with Static build in Windows !
    By Krish in forum Installation and Deployment
    Replies: 1
    Last Post: 17th March 2008, 14:37

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.