Linker error when trying to compile my executable
-
wrote on 2 Mar 2023, 12:32 last edited by
Hi everyone.
I'm currently having these LNK2019 errors when trying to compile my application :
MyHomeMadeLib.lib(qapplication.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_qstyle(void)" (?qInitResources_qstyle@@YAHXZ) referenced in function "public: __cdecl QApplication::QApplication(int &,char * *,int)" (??0QApplication@@QEAA@AEAHPEAPEADH@Z) MyHomeMadeLib.lib(qapplication.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_qmessagebox(void)" (?qInitResources_qmessagebox@@YAHXZ) referenced in function "public: __cdecl QApplication::QApplication(int &,char * *,int)" (??0QApplication@@QEAA@AEAHPEAPEADH@Z) MyHomeMadeLib.lib(qwindowsintegration.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_openglblacklists(void)" (?qInitResources_openglblacklists@@YAHXZ) referenced in function "public: void __cdecl QWindowsIntegrationPrivate::parseOptions(class QWindowsIntegration *,class QList<class QString> const &)" (?parseOptions@QWindowsIntegrationPrivate@@QEAAXPEAVQWindowsIntegration@@AEBV?$QList@VQString@@@@@Z) MyHomeMadeLib.lib(qwindowscursor.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_cursors(void)" (?qInitResources_cursors@@YAHXZ) referenced in function "public: __cdecl QWindowsCursor::QWindowsCursor(class QPlatformScreen const *)" (??0QWindowsCursor@@QEAA@PEBVQPlatformScreen@@@Z)
My version of Qt is Qt6.2.6, I'm using cmake and here's the configure options I used to build it:
configure -prefix C:\qt-install-6.2.6 -release -static -feature-relocatable -submodules qtsvg,qtbase
MyHomeMadeLib.lib is an amalgam of the libs Qt6Core.lib Qt6Gui.lib Qt6Widgets.lib Qt6Svg.lib Qt6SvgWidgets.lib Qt6BundledLibpng.lib Qt6BundledPcre2.lib Qt6BundledHarfbuzz.lib Qt6BundledFreetype.lib and qwindows.lib
I even tried using all the .lib generated after the Qt build, but I still have the same result.
This issue isn't new (was already present in Qt6.2.4), and we solved it by slightly modifying the Qt source code. But this hack eventually brought some other issues with it so now i'd like to make things work "cleanly" without modifying Qt's source code.Any help or hint would greatly be appreciated, thanks.
-
Hi everyone.
I'm currently having these LNK2019 errors when trying to compile my application :
MyHomeMadeLib.lib(qapplication.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_qstyle(void)" (?qInitResources_qstyle@@YAHXZ) referenced in function "public: __cdecl QApplication::QApplication(int &,char * *,int)" (??0QApplication@@QEAA@AEAHPEAPEADH@Z) MyHomeMadeLib.lib(qapplication.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_qmessagebox(void)" (?qInitResources_qmessagebox@@YAHXZ) referenced in function "public: __cdecl QApplication::QApplication(int &,char * *,int)" (??0QApplication@@QEAA@AEAHPEAPEADH@Z) MyHomeMadeLib.lib(qwindowsintegration.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_openglblacklists(void)" (?qInitResources_openglblacklists@@YAHXZ) referenced in function "public: void __cdecl QWindowsIntegrationPrivate::parseOptions(class QWindowsIntegration *,class QList<class QString> const &)" (?parseOptions@QWindowsIntegrationPrivate@@QEAAXPEAVQWindowsIntegration@@AEBV?$QList@VQString@@@@@Z) MyHomeMadeLib.lib(qwindowscursor.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_cursors(void)" (?qInitResources_cursors@@YAHXZ) referenced in function "public: __cdecl QWindowsCursor::QWindowsCursor(class QPlatformScreen const *)" (??0QWindowsCursor@@QEAA@PEBVQPlatformScreen@@@Z)
My version of Qt is Qt6.2.6, I'm using cmake and here's the configure options I used to build it:
configure -prefix C:\qt-install-6.2.6 -release -static -feature-relocatable -submodules qtsvg,qtbase
MyHomeMadeLib.lib is an amalgam of the libs Qt6Core.lib Qt6Gui.lib Qt6Widgets.lib Qt6Svg.lib Qt6SvgWidgets.lib Qt6BundledLibpng.lib Qt6BundledPcre2.lib Qt6BundledHarfbuzz.lib Qt6BundledFreetype.lib and qwindows.lib
I even tried using all the .lib generated after the Qt build, but I still have the same result.
This issue isn't new (was already present in Qt6.2.4), and we solved it by slightly modifying the Qt source code. But this hack eventually brought some other issues with it so now i'd like to make things work "cleanly" without modifying Qt's source code.Any help or hint would greatly be appreciated, thanks.
wrote on 2 Mar 2023, 12:42 last edited by -
-
wrote on 3 Mar 2023, 16:20 last edited by
In the link provided by JonB, in the comment chain someone gave the fix, I'll post it here too in case someone comes across this thread:
In your Qt build directory, under \lib\objects-Release (or objects-Debug if built in debug mode) there are a number of directories ending with resources_X
Inside those directories i found some .obj files, linking some of those files in my project fixed my missing symbol issue.
-
1/4