[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:

    @RESOURCES +=
    whr.qrc@

    and the whr.qrc file is the following:

    @<RCC>
    <qresource>
    <file>img/quit.png</file>
    <file>img/database.png</file>
    <file>img/qt.png</file>
    <file>img/about.png</file>
    </qresource>
    <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:

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

    What am I missing here?


  • Moderators

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

    @<RCC>
    <qresource prefix="/">
    <file>books4132-1.png</file>
    </qresource>
    </RCC>@



  • 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:

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

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

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

    I am using qt creator 2.2.1. Any idea?



  • 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.

    @<RCC>
    <qresource prefix="/">
    <file>img/about.png</file>
    <file>img/database.png</file>
    <file>img/qt.png</file>
    <file>img/quit.png</file>
    </qresource>
    </RCC>
    @



  • 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.



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.