I've got following scenario:
When I build the Qt app in Qt Creator I get following output:
10:39:52: The process "D:\Qt\Qt5.3.1\5.3\msvc2013\bin\qmake.exe" exited normally.
10:39:52: Starting: "D:\Qt\Qt5.3.1\Tools\QtCreator\bin\jom.exe"
D:\Qt\Qt5.3.1\Tools\QtCreator\bin\jom.exe -f Makefile.Release
link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:release\TEST_app_Qt.exe.embed.manifest /OUT:release\TEST_app_Qt.exe @C:\Users\gortner\AppData\Local\Temp\TEST_app_Qt.exe.12772.63.jom
MyLib.lib(MyLib.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__CryptAcquireContextW@20
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__CryptSetKeyParam@16
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__RegSetValueExA@24
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__RegQueryValueExA@24
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__CryptReleaseContext@8
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__RegOpenKeyExA@20
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__CryptImportKey@24
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__RegDeleteValueA@8
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__CryptDestroyKey@4
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__GetUserNameA@8
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__CryptDecrypt@24
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__SHGetFolderPathA@20
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__RegCloseKey@4
release\TEST_app_Qt.exe : fatal error LNK1120: 13 unresolved externals
jom: D:\Development\build-TEST_app_Qt-Desktop_Qt_5_3_MSVC2013_32bit-Release\Makefile.Release [release\TEST_app_Qt.exe] Error 1120
jom: D:\Development\build-TEST_app_Qt-Desktop_Qt_5_3_MSVC2013_32bit-Release\Makefile [release] Error 2
10:39:52: The process "D:\Qt\Qt5.3.1\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project TEST_app_Qt (kit: Desktop Qt 5.3 MSVC2013 32bit)
When executing step 'Make'
10:39:52: Elapsed time: 00:01.
My .pro file:
#
# Project created by QtCreator 2014-09-01T11:10:50
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = TEST_app_Qt
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
mymath.cpp \
stdafx.cpp
HEADERS += mainwindow.h \
mymath.h \
targetver.h \
stdafx.h
FORMS += \
mainwindow.ui
INCLUDEPATH += $$PWD/inc
DEPENDPATH += $$PWD/inc
win32: LIBS += -L$$PWD/lib/ -lMyLib
#win32: PRE_TARGETDEPS += $$PWD/lib/MyLib.lib
QMAKE_CFLAGS_RELEASE -= -MT
QMAKE_CXXFLAGS_RELEASE -= MT
QMAKE_CFLAGS_RELEASE += /MD
QMAKE_CXXFLAGS_RELEASE += /MD
As mentioned above. When I use the lib in a VS project it works fine but in Qt i have troubles
If you look up the listed missing symbols in MSDN you will find that they are in Advapi32.lib. That import lib is not listed in the LIBS in your .pro file. Try adding the following:
win32: LIBS += Advapi32.lib