Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3444796
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:57:39+00:00 2026-05-18T08:57:39+00:00

I can not figure out how to initialize Qt resources declared in and used

  • 0

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 library, added a prefix named “resource”, and added a file “files/styleSheet.xsl”. The resource file is named “resources.qrc”. QFile::exists returns false?

MySharedLib::MySharedLib()
{

   // I think Q_INIT_RESOURCE basically expands to this:
   // The resource file is named "resources.qrc"
   extern int qInitResources_resources();
   qInitResources_resources(); 

      QString resourcePath = ":/resource/files/styleSheet.xsl";
      if( false == QFile::exists(resourcePath))
      {
         printf("*** Error - Resource path not found : \"%s\"\n",   resourcePath.toLatin1().data());
      }

}

Thanks in advance for any tips or suggestions,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:57:40+00:00Added an answer on May 18, 2026 at 8:57 am

    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
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have not used generics much and so cannot figure out if it is
I am working on a C project and can not figure out how to
I am receiving an error in my application and i can not figure out
In trying to figure out whether or not my code's inner loop is hitting
I still can't figure out how to make a subclass constructor follow its parent...
I can't for the life of me figure out how to do this properly.
I am new to .NET, and I'm can't seem to figure out something that
I must have changed something somewhere, but damned if I can figure out what
I can't figure out what's happening here. I've got a few lists set up,
I'm trying to present a standard ViewController modally, but can't figure out how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.