Nominate our 2022 Qt Champions!

[SOLVED] Qt resources

  • Hi
    I have developed an application using visual studio using the Qt plugin.
    This application consists of numerous dynamic libraries which have their own resource files.
    Now, when I come to use these resources within the library I find that I cannot access them unless I add the .qrc file to the application project.
    Is this the only way to achieve this or is there a better way?
    I have tried using Q_INIT_RESOURCE macro but this gives me an unresolved linker errror

    JobManager.obj : error LNK2019: unresolved external symbol "int __cdecl qInitResources_JobMangement(void)" (?qInitResources_JobMangement@@YAHXZ) referenced in function "private: void __thiscall JobManagement::JobManager::onASLCreateJob(void)" (?onASLCreateJob@JobManager@JobManagement@@AAEXXZ)
    1>Build\Debug\JobManagementd.dll : fatal error LNK1120: 1 unresolved externals


  • Lifetime Qt Champion


    Did you follow the documentation Q_INIT_RESOURCE about initialization with DLLs ?

  • Hi
    Thanks for your reply
    I have solved this issue by including the generated qrc_xxx.cpp in my visual studio project

Log in to reply