Results 1 to 4 of 4

Thread: Linker errors migrating from QT4 to QT5 - Am stumped please help

  1. #1
    Join Date
    Jun 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Linker errors migrating from QT4 to QT5 - Am stumped please help

    Hello people,

    I've been working on migrating my 32 bit QT4 app to 64 bit QT5 on Windows VC2010. Everything goes well until the final linkage phases of my app, at which point I get a slew of linker errors (LNK2001: unresolved external). It's apparent to me that the build process is not finding the right Windows lib files to against (maybe debug vs release, MT vs MD?), but I'm stumped at finding the actual problem.

    Any ideas would be really helpful, even if it's just things to investigate.

    My pro file and output are below. Here's some precursors. I'm using VC2010 with SDK7.1. I've built the QT library from source using the following config command...

    configure -release -opensource -shared -platform win32-msvc2010 -ltcg -strip -no-openssl -no-accessibility -no-qml-debug -qt-sql-sqlite -opengl desktop -no-openvg -audio-backend -no-style-fusion -no-style-windowsce -no-style-windowsxp -no-style-windowsmobile -nomake examples -nomake tests -mp

    I'm linking against the QT DLLs (shared). I'm building with the MD option. The QT framework appears to build fine, I can run designer.exe etc. I seem to get link errors associated with my use of boost and other (my own) libraries. I have no problem with building 64 bit non-QT console apps.

    My pro file...
    Qt Code:
    1. # -----------------------------------------------------------------------------
    2. # CONFIGURATION
    3. # -----------------------------------------------------------------------------
    4.  
    5. # Setup
    6. TEMPLATE = app
    7. CONFIG *= qt warn_on exceptions
    8. QMAKE_MAKEFILE = makefile
    9. QT *= widgets
    10.  
    11. # g++ compiler flags
    12. *g++:QMAKE_CXXFLAGS *= -s
    13.  
    14. # Paths
    15. TARGET = hwipe
    16. DESTDIR = ./bin
    17. INCLUDEPATH *= ./src
    18. INCLUDEPATH *= $(DEVLIB_PATH)/dogma/inc
    19. INCLUDEPATH *= $(DEVLIB_PATH)/adsa/inc
    20. INCLUDEPATH *= $(DEVLIB_PATH)/cdog/inc
    21.  
    22. # Defines
    23. DEFINES *= BOOST_NO_DEPRECATED
    24. win32:DEFINES *= WINDOWS DOGMA_MSW
    25.  
    26. # LIBRARIES (shouldn't be needed under mingw)
    27. win32-msvc*:LIBS *= -ladvapi32 -lshell32 -luser32 -lwinmm
    28.  
    29. contains(QMAKE_HOST.arch, x86_64) {
    30. DEFINES *= DOGMA_LIB64
    31. win32:LIBS *= -L$(DEVLIB_PATH)/dogma/lib/win64 -ldogma -ldogma-lang
    32. win32:LIBS *= -L$(DEVLIB_PATH)/adsa/lib/win64 -ladsa
    33.  
    34. # Need path from MS SDK7.1
    35. win32:LIBS *= -L"C:/Program Files/Microsoft SDKs/Windows/v7.1/Lib"
    36. win32:LIBS *= -L"C:/Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64"
    37.  
    38.  
    39. } else {
    40. DEFINES *= DOGMA_LIB32
    41. win32:LIBS *= -L$(DEVLIB_PATH)/dogma/lib/win32 -ldogma -ldogma-lang
    42. win32:LIBS *= -L$(DEVLIB_PATH)/adsa/lib/win32 -ladsa
    43. }
    44.  
    45. # SPECIAL LINKER (on MinGW we need to put this in rc file instead)
    46. win32-msvc*:QMAKE_LFLAGS *= /MANIFESTUAC:\"level=\'asInvoker\' uiAccess=\'false\'\"
    47.  
    48. # Objects and temp files
    49. OBJECTS_DIR = ./obj/release
    50. RCC_DIR = ./tmp/rcc
    51. MOC_DIR = ./tmp/moc
    52. UI_DIR = ./tmp/uic
    53. QMAKE_LINK_OBJECT_SCRIPT = ./tmp/object_script
    54.  
    55. # Needed only for external boost library
    56. boost_external {
    57.  
    58. INCLUDEPATH *= $(BOOST_PATH)
    59.  
    60. contains(QMAKE_HOST.arch, x86_64) {
    61. LIBS *= -L$(BOOST_PATH)/stage/lib/x64
    62. } else {
    63. LIBS *= -L$(BOOST_PATH)/stage/lib/x86
    64. }
    65.  
    66. } else {
    67.  
    68. LIBS *= -lboost_thread
    69.  
    70. }
    71.  
    72. # -----------------------------------------------------------------------------
    73. # DEVELOPMENT BUILD
    74. # -----------------------------------------------------------------------------
    75.  
    76. # Development build
    77. dev_build {
    78.  
    79. # Additional includes
    80. INCLUDEPATH *= $(DEVLIB_PATH)/tdog/inc
    81.  
    82. # Additional Defines
    83. DEFINES *= HWIPE_DEBUG INTEG_DEBUG CDOG_BUILD_TRACE
    84.  
    85. # Additional Libraries
    86. contains(QMAKE_HOST.arch, x86_64) {
    87. win32:LIBS *= -L$(DEVLIB_PATH)/tdog/lib/win64 -ltdog
    88. win32:LIBS *= -L$(DEVLIB_PATH)/cdog/lib/win64 -lcdog
    89. } else {
    90. win32:LIBS *= -L$(DEVLIB_PATH)/tdog/lib/win32 -ltdog
    91. win32:LIBS *= -L$(DEVLIB_PATH)/cdog/lib/win32 -lcdog
    92. }
    93.  
    94. }
    95.  
    96. # -----------------------------------------------------------------------------
    97. # HEADER FILES
    98. # -----------------------------------------------------------------------------
    99. HEADERS *= src/main/hwapp.hpp
    100. ... etc
    101.  
    102. # -----------------------------------------------------------------------------
    103. # SOURCE FILES
    104. # -----------------------------------------------------------------------------
    105. SOURCES *= src/main/hwapp.cpp
    106. ... etc
    To copy to clipboard, switch view to plain text mode 


    and here is the compiler link output...


    1> moc_link_widget.cpp
    1> link /NOLOGO /DYNAMICBASE /NXCOMPAT /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /INCREMENTAL:NO /LTCG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:bin\hwipe.exe.embed.manifest /OUT:bin\hwipe.exe @C:\Users\andyt\AppData\Local\Temp\nm74B8.tmp
    1>main_window.obj : error LNK2001: unresolved external symbol __imp_CreateEventA
    1>libboost_thread-vc100-mt-1_49.lib(thread.obj) : error LNK2001: unresolved external symbol __imp_CreateEventA
    1>libboost_thread-vc100-mt-1_49.lib(thread.obj) : error LNK2001: unresolved external symbol __imp_CloseHandle
    1>main_window.obj : error LNK2001: unresolved external symbol __imp_CloseHandle
    1>dogma.lib(file_utils.obj) : error LNK2001: unresolved external symbol __imp_CloseHandle

    ...

    1>libboost_thread-vc100-mt-1_49.lib(thread.obj) : error LNK2001: unresolved external symbol __imp_CreateWaitableTimerA
    1>qtmain.lib(qtmain_win.obj) : error LNK2001: unresolved external symbol __imp_GetCommandLineW
    1>bin\hwipe.exe : fatal error LNK1120: 115 unresolved externals
    1>NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\link.EXE"' : return code '0x460'
    1> Stop.
    1>NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe"' : return code '0x2'
    1> Stop.


    Thank you!

    Andy
    Last edited by anda_skoa; 30th March 2014 at 12:45. Reason: Added [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Linker errors migrating from QT4 to QT5 - Am stumped please help

    That doesn't look Qt related, you seem to be getting linker errors for Boost.
    Have you built Boost with the new compiler/settings?

    Cheers,
    _

  3. #3
    Join Date
    Jun 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Linker errors migrating from QT4 to QT5 - Am stumped please help

    Thanks for the reply. I'm still stuck on this, so help would be appreciated.

    >Have you built Boost with the new compiler/settings?

    I'm attempting to migrate the app from 32 bit from 64 bit, so yes. However, I'm trying to link against a 64 bit version of boost, and it's not just boost where I get linker errors, it's everywhere...

    1>main_window.obj : error LNK2001: unresolved external symbol __imp_CloseHandle
    1>dogma.lib(file_utils.obj) : error LNK2001: unresolved external symbol __imp_CloseHandle

    domga.lib is my own library. I have both 32 bit and 64 bit builds of this and have no problem building non-QT consolve apps against either version. Why can't I build a QT app against it, where previously the 32 bit version built fine?

    Clearly I'm missing something with the QT pro file, like something switch that says "64 bit" or something that should be completely obvious, but just isn't to me.

    How can I track this down?

  4. #4
    Join Date
    Jun 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Linker errors migrating from QT4 to QT5 - Am stumped please help

    Solved. Solution here for others...

    This line is needed in the pro-file to pick up the 64 bit libs...

    win32:LIBS *= -L"C:/Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64"

    I had this previously (see pro file in first page), but also had an extra non-64 bit directory from the SDK. It started to build when I removed the other line.

    Also had problems with boost "Macro argument mismatch bug" errors. Had to put this line in the pro file to solve this...

    QMAKE_COMPILER_DEFINES = _WIN32

    More here...

    http://stackoverflow.com/questions/1...t-mismatch-bug

Similar Threads

  1. Linker errors Phonon lib
    By tcampos in forum Qt Programming
    Replies: 2
    Last Post: 3rd May 2012, 18:43
  2. linker errors from MinGW 4.4.0 for Qt 4.6.2
    By planetLars in forum Qt Tools
    Replies: 1
    Last Post: 15th April 2010, 21:30
  3. please help with linker errors
    By jimboqt in forum Qt Programming
    Replies: 1
    Last Post: 5th July 2007, 10:49
  4. Linker errors!!
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 25th April 2006, 09:14
  5. Linker Errors
    By MarkoSan in forum Qt Programming
    Replies: 5
    Last Post: 7th March 2006, 19:30

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.