Visual Studio 2017 unresolved external symbol struct QStaticPlugin
-
I'm attempting to build a project that relies on Qt. I'm most of the way there and have one last unresolved symbol related to Qt plugins, error message below.
I'm using qt-everywhere-opensource-src-5.9.1.zip and as I need to build x86 I'm linking against the .lib files in the msvc2015\lib directory. I've added qtmain.lib, Qt5Core.lib, Qt5Widgets.lib, Qt5Gui.lib and Qt5Network.lib. Search results I need to also link against Qt5PlatformSupport.lib and/or qwindows.lib but neither of those libraries are available. Is there a different mechanism required to link for a Qt static plugin? Note I'm still trying to build so I haven't hit the more common problem of not being able to locate the plugin dll's.
Severity Code Description Project File Line Suppression State
Error LNK2001 unresolved external symbol "struct QStaticPlugin const __cdecl qt_static_plugin_QWindowsIntegrationPlugin(void)" (?qt_static_plugin_QWindowsIntegrationPlugin@@YA?BUQStaticPlugin@@XZ) bitcoin-qt F:\Dev\github\sipsorcery_bitcoin\contrib\msvc\bitcoin-qt\bitcoin.obj 1 -
@azaclauson said in Visual Studio 2017 unresolved external symbol struct QStaticPlugin:
Is there a different mechanism required to link for a Qt static plugin?
Not for linking, no. You should be able to find those libraries in the
plugins
directory of your build (I think they were in<QtDir>plugins/platforms
). You also might need to initialize each of the plugins manually in code as you're linking static:#include <QtPlugin> Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) Q_IMPORT_PLUGIN(qjpeg) // ... etc.
More info here.
-
Not for linking, no. You should be able to find those libraries in the plugins directory of your build (I think they were in <QtDir>plugins/platforms). You also might need to initialize each of the plugins manually in code as you're linking static:
If I've understood correctly the default Qt downloads available at https://www1.qt.io/download-open-source/#section-2 are built with shared rather than static plugins. In order to get Qt with static plugins I need to do a custom build with the "-static" parameter specified for configure.bat?
That leaves me in a chicken and egg situation. I've been unable to get very far with building Qt either from the git repo or from the above download (if anyone has a configure command that works with the Visual Studio 2017 command prompt I'd be very grateful). I can't make changes to the consumer project I'm attempting to build so need to stick with static plugins.
-
@azaclauson said in Visual Studio 2017 unresolved external symbol struct QStaticPlugin:
If I've understood correctly the default Qt downloads available at https://www1.qt.io/download-open-source/#section-2 are built with shared rather than static plugins.
I believe so.
In order to get Qt with static plugins I need to do a custom build with the "-static" parameter specified for configure.bat?
That'd be implied if the installer provides only a shared library build.
I've been unable to get very far with building Qt either from the git repo or from the above download (if anyone has a configure command that works with the Visual Studio 2017 command prompt I'd be very grateful).
I suggest you open a new topic for that specifically and provide the configure command you had tried, what was the output and what didn't work.