September 26, 2011

fluca1978 fluca1978
Lab Rat
472 posts

[SOLVED]problem with resources: file not found

 

Hi all,
I want to compile a set of icons as resources into my qt application. To do this I’ve placed the following into the project file:

  1. RESOURCES += \
  2.     whr.qrc

and the whr.qrc file is the following:

  1. <RCC>
  2.  <file>img/quit.png</file>
  3.  <file>img/database.png</file>
  4.  <file>img/qt.png</file>
  5.  <file>img/about.png</file>
  6. <RCC/>

and the img directory is at the same level of the project and qrc file (within my project folder).
When I try to clean-compile the project inside the qdeveloper ide I got the following error:

  1. make: *** [qrc_whr.cpp] Error 1
  2. The process "/usr/bin/make" exited with code 2.
  3. Error while building project WHR (target: Desktop)
  4. When executing build step 'Make'

What am I missing here?

5 replies

September 26, 2011

Eddy Eddy
Area 51 Engineer
1571 posts

maybe because you don’t have a prefix like this :

  1. <RCC>
  2.     <qresource prefix="/">
  3.         <file>books4132-1.png</file>
  4.     </qresource>
  5. </RCC>

 Signature 

Moderator
Qt Certified Specialist
Nokia Qt Ambassador

September 26, 2011

fluca1978 fluca1978
Lab Rat
472 posts

Uhm..it maybe, but I think the problem is another.
After having restarted the qtcreator I can see the qrc file listed under the resources, but when I double click on it an error dialog appears saying that it is impossible to open the file:

  1. Cannot open file /sviluppo/c/WHR/whr.qrc!

but on the filesystem the file seems to be in the right place:

  1. $ ls -l *.qrc
  2. -rw-r--r-- 1 luca luca 149 2011-09-26 14:26 whr.qrc

I am using qt creator 2.2.1. Any idea?

September 26, 2011

fluca1978 fluca1978
Lab Rat
472 posts

I have removed the file and recreated it with the resource editor. The only difference I see when viewed as a text file with the previous one is about spacing…not sure what the problem was but is fixed now.

  1. <RCC>
  2.     <qresource prefix="/">
  3.         <file>img/about.png</file>
  4.         <file>img/database.png</file>
  5.         <file>img/qt.png</file>
  6.         <file>img/quit.png</file>
  7.     </qresource>
  8. </RCC>

September 26, 2011

fluca1978 fluca1978
Lab Rat
472 posts

Just to add a quick note: after a reboot of the qtcreator the problem happened again. It seems the resource file is kept into cache, since it was pointing to wrong resource files. Even a clean all did not solved the problem. The only solution was to manually run qmake from the build menu.

November 25, 2012

GB GB
Lab Rat
1 posts

Same issue with demo compilations windows in mingw compilation. Checked syntax’s and declarations right, gives an qrc_xyz.cpp “file not found error” when compiling xyz.qrc in the same directory for .png files.

 
  ‹‹ QListwidget item with mousedoubleclicked      Is there a way to detect when a file copy process finish? ››

You must log in to post a reply. Not a member yet? Register here!