Link errors on a statically build Qt application
-
i have statically configured version of qt.
when i try to build my application using these statically linked libs,i get these errors.@error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QString::~QString(void)" (_imp??1QString@@QAA@XZ) referenced in function "public: class QString __cdecl CHMIAbout::GetCopyrightMessage(void)" (?GetCopyrightMessage@CHMIAbout@@QAA?AVQString@@XZ)
1>HMIAbout.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QString::QString(class QString const &)" (_imp??0QString@@QAA@ABV0@@Z) referenced in function "public: class QString __cdecl CHMIAbout::GetCopyrightMessage(void)" (?GetCopyrightMessage@CHMIAbout@@QAA?AVQString@@XZ)
1>HMIAbout.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QString::QString(char const *)" (_imp??0QString@@QAA@PBD@Z) referenced in function "public: class QString __cdecl CHMIAbout::GetCopyrightMessage(void)" (?GetCopyrightMessage@CHMIAbout@@QAA?AVQString@@XZ)@do anyone know how to fix this.
-
this is a bit less information.
Can you please show us your project file.
And you are 100% sure, you have a Qt build for static linkage and that version is used? -
i am not exactly sure about the Qt static build.On static build i got these errors.
@QtGuid.lib(qimagereader.obj) : error LNK2019: unresolved external symbol "public: static bool __cdecl QGifHandler::canRead(class QIODevice *)" (?canRead@QGifHandler@@SA_NPAVQIODevice@@@Z) referenced in function "class QImageIOHandler * __cdecl createReadHandlerHelper(class QIODevice *,class QByteArray const &,bool,bool)" (?createReadHandlerHelper@@YAPAVQImageIOHandler@@PAVQIODevice@@ABVQByteArray@@_N2@Z)
1>QtGuid.lib(qimagereader.obj) : error LNK2019: unresolved external symbol "public: __cdecl QGifHandler::QGifHandler(void)" (??0QGifHandler@@QAA@XZ) referenced in function "class QImageIOHandler * __cdecl createReadHandlerHelper(class QIODevice *,class QByteArray const &,bool,bool)" (?createReadHandlerHelper@@YAPAVQImageIOHandler@@PAVQIODevice@@ABVQByteArray@@_N2@Z)
1>QtGuid.lib(qimagewriter.obj) : error LNK2001: unresolved external symbol "public: __cdecl QGifHandler::QGifHandler(void)" (??0QGifHandler@@QAA@XZ)
1>QtGuid.lib(jmemmgr.obj) : error LNK2019: unresolved external symbol getenv referenced in function jinit_memory_mgr
1>....\bin\qmlviewer.exe : fatal error LNK1120: 3 unresolved externals@i used this to configure
@configure -platform win32-msvc2008 -xplatform wince60un20-mipsiv_fp-msvc2008 -opensource -release -qt-libjpeg -qt-gif -qt-libpng -no-qt3support -no-phonon -no-phonon-backend -xmlpatterns -exceptions -arch windowsce -nomake examples -nomake demos -static@
is there any other changes to be done to the qmake.conf and project settings.??
-
Hi nitin777, gif could be in an imageplugin, I'm not 100% sure. so perhaps, you need that plugin for static binding. I never tried static binding with MSVC compiler.
You could search the Qt source for where the QGifHandler class is.
-
I've got the similar error while linking my projetc with Qt in a static way.
After 2 hours to understand the reason of the error. I found that the cause was because the directive Q_CORE_EXPORT should not be define with __declspec(dllexport). So to solve the problem I used the declaration of QT_NODLL. I've passed -DQT_NODLL to the compilator of my makefile. After the compilation was ok -
I've got the similar error while linking my projetc with Qt in a static way.
After 2 hours to understand the reason of the error. I found that the cause was because the directive Q_CORE_EXPORT should not be define with __declspec(dllexport). So to solve the problem I used the declaration of QT_NODLL. I've passed -DQT_NODLL to the compilator of my makefile. After the compilation was ok -
This post is deleted! -
This post is deleted!