Project compiling properly without qrc file
When building QT application on windows for some reason it will not build properly when I include the .qrc resource. If I remove the resources with the .qrc it compiles.
I have been building on windows XP by going to the directory of QTDIR/bin in command prompt and typing:
QtDIR\bin>qmake -o Makefile ProjectDir\project.pro
Not certain to why it works without the resource file, but including it the make returns an error saying "...rcc.exe...file does not exist project.qrc"
Any help is greatly appreciated.
-goodz
Re: Project compiling properly without qrc file
Where did you place project.qrc?
Re: Project compiling properly without qrc file
It's all in the same project folder. No subdirectories are used to store the project's files.
Re: Project compiling properly without qrc file
Have youd had your resource file to the *.pro file of your project?
Code:
RESOURCES = myresource.qrc
Re: Project compiling properly without qrc file
If I don't add the *.qrc file to the *.pro it will compile properly. If I add the resource it will throw an error saying this file does not exist.
On a side note, I'm using QT SDK and if I build for debugging it will compile properly and run the program with the resource included in the project file.
Thanks again.
Re: Project compiling properly without qrc file
Please show us the code where you use data from the resource file and paste the contents of your qmake project file.
Re: Project compiling properly without qrc file
Sure. I'm currently just trying to compile an example from the book C++ GUI Programming with Qt4, 2nd Edition.
iconeditor.qrc
Code:
<RCC>
<qresource>
<file>images/mouse.png</file>
</qresource>
</RCC>
iconeditor.pro
Code:
TEMPLATE = app
HEADERS = iconeditor.h
SOURCES = iconeditor.cpp \
main.cpp
RESOURCES = iconeditor.qrc
Re: Project compiling properly without qrc file
I meant the code where you are using the data from the resource file.
Re: Project compiling properly without qrc file
Doh! I meant to post that.. Sorry.
It's in the main.cpp.
Code:
iconEditor.
setIconImage(QImage(":/images/mouse.png"));
Re: Project compiling properly without qrc file
Looks fine. What happens if you manually run rcc.exe on the qrc file?
Re: Project compiling properly without qrc file
I'm not certain how to do that? Currently I am at work so I can't do it till later this afternoon.
Re: Project compiling properly without qrc file
Open the Qt command prompt, cd to the directory where the qrc file is and run rcc.exe iconeditor.qrc
Re: Project compiling properly without qrc file
Alright I got it to compile using the qmake; I didn't realize I was doing it wrong. Apologies.
However, it doesn't build an executable. Am I still doing something wrong?
Re: Project compiling properly without qrc file
Re: Project compiling properly without qrc file
Nevermind I was confused on how the qmake worked I researched it and the compilation on windows was a bit confusing to me because make wasn 't recognized; however, after a little more research I found that I had to use mingw32-make.
I really appreciate your help.