PDA

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



nimingzhe2008
9th September 2012, 06:59
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.

ChrisW67
9th September 2012, 23:23
You must re-run qmake after changing the PRO file or the new build rules, in this case the one the processes the resource file, will not be present.

BTW: Line 10 of main.cpp will not open the icon from the resource. Try ":/images/accept.png"