#undef _sense_of_humor
27th March 2014, 12:35
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...
# -----------------------------------------------------------------------------
# CONFIGURATION
# -----------------------------------------------------------------------------
# Setup
TEMPLATE = app
CONFIG *= qt warn_on exceptions
QMAKE_MAKEFILE = makefile
QT *= widgets
# g++ compiler flags
*g++:QMAKE_CXXFLAGS *= -s
# Paths
TARGET = hwipe
DESTDIR = ./bin
INCLUDEPATH *= ./src
INCLUDEPATH *= $(DEVLIB_PATH)/dogma/inc
INCLUDEPATH *= $(DEVLIB_PATH)/adsa/inc
INCLUDEPATH *= $(DEVLIB_PATH)/cdog/inc
# Defines
DEFINES *= BOOST_NO_DEPRECATED
win32:DEFINES *= WINDOWS DOGMA_MSW
# LIBRARIES (shouldn't be needed under mingw)
win32-msvc*:LIBS *= -ladvapi32 -lshell32 -luser32 -lwinmm
contains(QMAKE_HOST.arch, x86_64) {
DEFINES *= DOGMA_LIB64
win32:LIBS *= -L$(DEVLIB_PATH)/dogma/lib/win64 -ldogma -ldogma-lang
win32:LIBS *= -L$(DEVLIB_PATH)/adsa/lib/win64 -ladsa
# Need path from MS SDK7.1
win32:LIBS *= -L"C:/Program Files/Microsoft SDKs/Windows/v7.1/Lib"
win32:LIBS *= -L"C:/Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64"
} else {
DEFINES *= DOGMA_LIB32
win32:LIBS *= -L$(DEVLIB_PATH)/dogma/lib/win32 -ldogma -ldogma-lang
win32:LIBS *= -L$(DEVLIB_PATH)/adsa/lib/win32 -ladsa
}
# SPECIAL LINKER (on MinGW we need to put this in rc file instead)
win32-msvc*:QMAKE_LFLAGS *= /MANIFESTUAC:\"level=\'asInvoker\' uiAccess=\'false\'\"
# Objects and temp files
OBJECTS_DIR = ./obj/release
RCC_DIR = ./tmp/rcc
MOC_DIR = ./tmp/moc
UI_DIR = ./tmp/uic
QMAKE_LINK_OBJECT_SCRIPT = ./tmp/object_script
# Needed only for external boost library
boost_external {
INCLUDEPATH *= $(BOOST_PATH)
contains(QMAKE_HOST.arch, x86_64) {
LIBS *= -L$(BOOST_PATH)/stage/lib/x64
} else {
LIBS *= -L$(BOOST_PATH)/stage/lib/x86
}
} else {
LIBS *= -lboost_thread
}
# -----------------------------------------------------------------------------
# DEVELOPMENT BUILD
# -----------------------------------------------------------------------------
# Development build
dev_build {
# Additional includes
INCLUDEPATH *= $(DEVLIB_PATH)/tdog/inc
# Additional Defines
DEFINES *= HWIPE_DEBUG INTEG_DEBUG CDOG_BUILD_TRACE
# Additional Libraries
contains(QMAKE_HOST.arch, x86_64) {
win32:LIBS *= -L$(DEVLIB_PATH)/tdog/lib/win64 -ltdog
win32:LIBS *= -L$(DEVLIB_PATH)/cdog/lib/win64 -lcdog
} else {
win32:LIBS *= -L$(DEVLIB_PATH)/tdog/lib/win32 -ltdog
win32:LIBS *= -L$(DEVLIB_PATH)/cdog/lib/win32 -lcdog
}
}
# -----------------------------------------------------------------------------
# HEADER FILES
# -----------------------------------------------------------------------------
HEADERS *= src/main/hwapp.hpp
... etc
# -----------------------------------------------------------------------------
# SOURCE FILES
# -----------------------------------------------------------------------------
SOURCES *= src/main/hwapp.cpp
... etc
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
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...
# -----------------------------------------------------------------------------
# CONFIGURATION
# -----------------------------------------------------------------------------
# Setup
TEMPLATE = app
CONFIG *= qt warn_on exceptions
QMAKE_MAKEFILE = makefile
QT *= widgets
# g++ compiler flags
*g++:QMAKE_CXXFLAGS *= -s
# Paths
TARGET = hwipe
DESTDIR = ./bin
INCLUDEPATH *= ./src
INCLUDEPATH *= $(DEVLIB_PATH)/dogma/inc
INCLUDEPATH *= $(DEVLIB_PATH)/adsa/inc
INCLUDEPATH *= $(DEVLIB_PATH)/cdog/inc
# Defines
DEFINES *= BOOST_NO_DEPRECATED
win32:DEFINES *= WINDOWS DOGMA_MSW
# LIBRARIES (shouldn't be needed under mingw)
win32-msvc*:LIBS *= -ladvapi32 -lshell32 -luser32 -lwinmm
contains(QMAKE_HOST.arch, x86_64) {
DEFINES *= DOGMA_LIB64
win32:LIBS *= -L$(DEVLIB_PATH)/dogma/lib/win64 -ldogma -ldogma-lang
win32:LIBS *= -L$(DEVLIB_PATH)/adsa/lib/win64 -ladsa
# Need path from MS SDK7.1
win32:LIBS *= -L"C:/Program Files/Microsoft SDKs/Windows/v7.1/Lib"
win32:LIBS *= -L"C:/Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64"
} else {
DEFINES *= DOGMA_LIB32
win32:LIBS *= -L$(DEVLIB_PATH)/dogma/lib/win32 -ldogma -ldogma-lang
win32:LIBS *= -L$(DEVLIB_PATH)/adsa/lib/win32 -ladsa
}
# SPECIAL LINKER (on MinGW we need to put this in rc file instead)
win32-msvc*:QMAKE_LFLAGS *= /MANIFESTUAC:\"level=\'asInvoker\' uiAccess=\'false\'\"
# Objects and temp files
OBJECTS_DIR = ./obj/release
RCC_DIR = ./tmp/rcc
MOC_DIR = ./tmp/moc
UI_DIR = ./tmp/uic
QMAKE_LINK_OBJECT_SCRIPT = ./tmp/object_script
# Needed only for external boost library
boost_external {
INCLUDEPATH *= $(BOOST_PATH)
contains(QMAKE_HOST.arch, x86_64) {
LIBS *= -L$(BOOST_PATH)/stage/lib/x64
} else {
LIBS *= -L$(BOOST_PATH)/stage/lib/x86
}
} else {
LIBS *= -lboost_thread
}
# -----------------------------------------------------------------------------
# DEVELOPMENT BUILD
# -----------------------------------------------------------------------------
# Development build
dev_build {
# Additional includes
INCLUDEPATH *= $(DEVLIB_PATH)/tdog/inc
# Additional Defines
DEFINES *= HWIPE_DEBUG INTEG_DEBUG CDOG_BUILD_TRACE
# Additional Libraries
contains(QMAKE_HOST.arch, x86_64) {
win32:LIBS *= -L$(DEVLIB_PATH)/tdog/lib/win64 -ltdog
win32:LIBS *= -L$(DEVLIB_PATH)/cdog/lib/win64 -lcdog
} else {
win32:LIBS *= -L$(DEVLIB_PATH)/tdog/lib/win32 -ltdog
win32:LIBS *= -L$(DEVLIB_PATH)/cdog/lib/win32 -lcdog
}
}
# -----------------------------------------------------------------------------
# HEADER FILES
# -----------------------------------------------------------------------------
HEADERS *= src/main/hwapp.hpp
... etc
# -----------------------------------------------------------------------------
# SOURCE FILES
# -----------------------------------------------------------------------------
SOURCES *= src/main/hwapp.cpp
... etc
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