[Qbs] Q_INIT_RESOURCE on Windows
abbapoh at gmail.com
Tue Apr 7 23:33:34 CEST 2020
From the Qt documentation:
"The Q_INIT_RESOURCE() macro is necessary on some platforms for resources stored in a static library.»
This is a workaround to tell the linker not to throw resources away when linking a static library.
It is not required when using a dynamic library as far as I remember.
> 7 апр. 2020 г., в 21:26, Alberto Mardegan <mardy at users.sourceforge.net> написал(а):
> Hi there!
> I was about to write this to the QtProject mailing list, but then I
> got the doubt that this might be a QBS issue, so I thought of double
> checking with you guys first.
> I'm building a GUI application which comes with a shared library which
> contains some Qt resources that need to be made available to the
> However, on windows the build fails, both natively (you can check the
> AppVeyor logs here ) and cross-compiled with MXE from Linux. The
> error is:
> main.cpp.obj : error LNK2019: unresolved external symbol "int __cdecl
> qInitResources_mappero_ui(void)" (?qInitResources_mappero_ui@@YAHXZ)
> referenced in function main
> C:\projects\mappero\default\mappero.a4d1648d\mappero.exe : fatal error
> LNK1120: 1 unresolved externals
> The main.cpp files contains Q_INIT_RESOURCE(mappero_ui), and a file
> is present in the build directory, and it contains (among a lot of other
> stuff) the lines:
> int QT_RCC_MANGLE_NAMESPACE(qInitResources_mappero_ui)();
> int QT_RCC_MANGLE_NAMESPACE(qInitResources_mappero_ui)()
> int version = 3;
> (version, qt_resource_struct, qt_resource_name, qt_resource_data);
> return 1;
> I checked with the nm tool (provided by MXE), and the dll library indeed
> contains the qInitResources_mappero_ui() symbol; however, the symbol is
> not present in the MapperoUi.lib file generated in the same directory.
> Shouldn't the symbol in the generated qrc_mappero-ui.cpp file be wrapped
> in a Q_DECL_EXPORT() macro?
> Could it be that this is a qbs bug, that for some reason it does not
> invoke rcc with the right options?
>  https://ci.appveyor.com/project/mardy/mappero/builds/31993601
> http://www.mardy.it - Geek in un lingua international
> Qbs mailing list
> Qbs at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Qbs