Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [release/qrc_ICON.cpp] Error 1:File not found
Forum Updated to NodeBB v4.3 + New Features

[release/qrc_ICON.cpp] Error 1:File not found

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 10.6k Views 2 Watching
  • 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.
  • N Offline
    N Offline
    nimingzhe2008
    wrote on last edited by
    #1

    here is my code

    ICON.qrc
    @<!DOCTYPE RCC><RCC version="1.0">
    <qresource>
    <file>images/accept.png</file>
    </qresource>
    </RCC>
    @

    main.cpp
    @#include <QApplication>
    #include<QIcon>
    #include<QPushButton>
    #include<QAction>

    int main( int argc, char** argv )
    {
    QApplication app( argc, argv );

    QIcon w("/images/accept.png");
    QPushButton a;
    QAction *b=new QAction(w,QString("Icon"),0);

    a.addAction(b);
    a.show();

    return app.exec();
    }@

    empty2.pro
    @SOURCES +=
    main.cpp
    buttondialog.cpp

    HEADERS +=
    buttondialog.h

    RESOURCES +=
    ICON.qrc@

    When I build the project,Qt Creator shows" [release/qrc_ICON.cpp] Error 1:File not found".
    I don't know why.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      broadpeak
      wrote on last edited by
      #2

      you forget the colon ":"
      QIcon w(":/images/accept.png");
      if you use resource, you should use colon before the path string

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nimingzhe2008
        wrote on last edited by
        #3

        [quote author="broadpeak" date="1347262204"]you forget the colon ":"
        QIcon w(":/images/accept.png");
        if you use resource, you should use colon before the path string[/quote]

        Thank you.I have correct the code,but Qt Creator still shows the same error.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          broadpeak
          wrote on last edited by
          #4

          In qrc file you don't have prefix like this: <qresource prefix="/">

          1 Reply Last reply
          0
          • N Offline
            N Offline
            nimingzhe2008
            wrote on last edited by
            #5

            [quote author="broadpeak" date="1347285954"]In qrc file you don't have prefix like this: <qresource prefix="/"> [/quote]
            Thank you.I have correct the code again,but Qt Creator still shows the same error.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              broadpeak
              wrote on last edited by
              #6

              This is works for me:

              @
              #include <QApplication>
              #include <QIcon>
              #include <QPushButton>
              #include <QToolButton>
              #include <QAction>

              int main( int argc, char** argv )
              {
              QApplication app( argc, argv );

              QPushButton a;
              QIcon w(":/images/accept.png");
              QAction* b=new QAction( QString("Icon"), 0);
              a.setIcon(w);
              
              a.addAction(b);
              a.show();
              
              return app.exec();
              

              }
              @

              @
              <RCC>
              <qresource prefix="/">
              <file>images/accept.png</file>
              </qresource>
              </RCC>
              @

              @
              SOURCES +=
              main.cpp
              buttondialog.cpp

              HEADERS +=
              buttondialog.h
              buttondialog.h

              RESOURCES += icon.qrc
              @

              Pay attention when you paste this code, because the quotation marks (") can be wrong!

              1 Reply Last reply
              0
              • N Offline
                N Offline
                nimingzhe2008
                wrote on last edited by
                #7

                Thank you very much. Now I find that if I open the qrc file with Resource Editor,it will works well.The strange thing is if I use Plain Text Editor to open qrc file and paste the code,it will show error "[release/qrc_ICON.cpp] Error 1:File not found".

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  Hughen
                  wrote on last edited by
                  #8

                  I want to konw your solution about this problem, could you tell me?

                  [quote author="nimingzhe2008" date="1347289193"]Thank you very much. Now I find that if I open the qrc file with Resource Editor,it will works well.The strange thing is if I use Plain Text Editor to open qrc file and paste the code,it will show error "[release/qrc_ICON.cpp] Error 1:File not found".[/quote]

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    nimingzhe2008
                    wrote on last edited by
                    #9

                    [quote author="Hughen" date="1350390978"]I want to konw your solution about this problem, could you tell me?

                    [/quote]
                    sorry,no new solution.

                    1 Reply Last reply
                    0
                    • Stefan Monov76S Offline
                      Stefan Monov76S Offline
                      Stefan Monov76
                      wrote on last edited by
                      #10

                      I had the same error, except without the "file not found" part of the message. I opened the qrc file in the resource editor and noticed one filename was in red. This meant that the file cannot be found. Removed it from the qrc and now it works.

                      1 Reply Last reply
                      1

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved