Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    [SOLVED]problem with resources: file not found

    General and Desktop
    3
    6
    19263
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      fluca1978 last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • E
        Eddy last edited by

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

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

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply Reply Quote 0
        • F
          fluca1978 last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • F
            fluca1978 last edited by

            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>
            @

            1 Reply Last reply Reply Quote 0
            • F
              fluca1978 last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • G
                gbhat last edited by

                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.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post