[Qbs] Q_INIT_RESOURCE on Windows
Alberto Mardegan
mardy at users.sourceforge.net
Tue Apr 7 21:26:54 CEST 2020
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
application.
However, on windows the build fails, both natively (you can check the
AppVeyor logs here [1]) 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
release/MapperoUi.e4550a40/qrc_mappero-ui.cpp
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;
QT_RCC_PREPEND_NAMESPACE(qRegisterResourceData)
(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?
Ciao,
Alberto
[1] https://ci.appveyor.com/project/mardy/mappero/builds/31993601
--
http://www.mardy.it - Geek in un lingua international
More information about the Qbs
mailing list