How to initialize Qt resources from a shared library?

后端 未结 1 693
庸人自扰
庸人自扰 2021-02-20 10:48

I can not figure out how to initialize Qt resources declared in and used by a shared library under Red Hat Enterprise Linux 5.2.

I added a Qt resource file to my shared

相关标签:
1条回答
  • 2021-02-20 11:33

    The problem is that under Linux, you can not have identically named Qt resource files (*.qrc) in both your shared library and application. This is not a problem under Windows but under Linux it will only load one of the identically named resource files. I had named resource files in both my application and shared library files "resources.qrc". I renamed to "resourcesmylib.qrc" and "resourcesmyapp.qrc" and all was good. I did not need to add a call Q_INIT_RESOURCES to my library or call qInitResources_resources*.

    Solution

    • Use unique Qt resource file names for your library and application under Linux.

    Credit goes to Jaco N. on the Qt-Interest mailing list. Thank you Jaco!

    0 讨论(0)
提交回复
热议问题