Linking QT Application to Visual Studio Static 32 bit library fails
(sorry I accidentally posted this question 2 times and I do not know how do delete this duplicate)
I am trying to get up to speed with adding a new GUI front end to a previously console based application. The existing application was developed in Visual Studio 2012 Professional. The existing console application (executable) comprises a main() and about 20 or so static 32 bit libraries.
I used the QT Creator (qt-windows-opensource-5.1.1-msvc2012_opengl-x86_64-offline & qt-vs-addin-1.2.2-opensource) to create a dummy application (using the built in QT Gui Application wizard) and then I choose the add library context popup to add one of these static libraries to the linker.
Next I added a single line of code to use the generated main.cpp to bring in a reference from the static library and after qmaking and building the project, it complained as follows:
@main.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl LoadsetList::LoadsetList(void)" (??0LoadsetList@@QEAA@XZ) referenced in function main
main.obj:-1: error: LNK2019: unresolved external symbol "public: virtual __cdecl LoadsetList::~LoadsetList(void)" (??1LoadsetList@@UEAA@XZ) referenced in function main
debug\vcbuild.exe:-1: error: LNK1120: 2 unresolved externals@
Can anyone shed any light on what might be going wrong.
Here is the project file (note that the include paths are setup to point to my existing source code for the static libraries and QT seems to recognize the code by auto-completion.
Project created by QtCreator 2013-10-29T17:27:49
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = vcbuild
TEMPLATE = app
SOURCES += main.cpp
HEADERS += mainwindow.h
INCLUDEPATH += /main/ltib/cpas/include
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../ltib/cpas/win32/loadset/release/ -lloadset
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../ltib/cpas/win32/loadset/debug/ -lloadset
INCLUDEPATH += $$PWD/../../ltib/cpas/win32/loadset/Debug
DEPENDPATH += $$PWD/../../ltib/cpas/win32/loadset/Debug
win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../ltib/cpas/win32/loadset/release/loadset.lib
else:win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../ltib/cpas/win32/loadset/debug/loadset.lib
Here is the modified main.cpp: Note I simply put a single line referring to the LoadsetList object which resides in my static library
int main(int argc, char *argv)
QApplication a(argc, argv);
You can re-use it for another problem (hope you won't need to though) :)