PDA

View Full Version : Project compiling properly without qrc file



goodz
18th March 2010, 22:07
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

wysota
18th March 2010, 23:10
Where did you place project.qrc?

goodz
19th March 2010, 03:26
It's all in the same project folder. No subdirectories are used to store the project's files.

toutarrive
19th March 2010, 08:55
Have youd had your resource file to the *.pro file of your project?


RESOURCES = myresource.qrc

goodz
19th March 2010, 12:43
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.

wysota
19th March 2010, 12:55
Please show us the code where you use data from the resource file and paste the contents of your qmake project file.

goodz
19th March 2010, 13:23
Sure. I'm currently just trying to compile an example from the book C++ GUI Programming with Qt4, 2nd Edition.

iconeditor.qrc

<RCC>
<qresource>
<file>images/mouse.png</file>
</qresource>
</RCC>


iconeditor.pro

TEMPLATE = app
HEADERS = iconeditor.h
SOURCES = iconeditor.cpp \
main.cpp
RESOURCES = iconeditor.qrc

wysota
19th March 2010, 13:27
I meant the code where you are using the data from the resource file.

goodz
19th March 2010, 13:30
Doh! I meant to post that.. Sorry.


It's in the main.cpp.


iconEditor.setIconImage(QImage(":/images/mouse.png"));

wysota
19th March 2010, 13:37
Looks fine. What happens if you manually run rcc.exe on the qrc file?

goodz
19th March 2010, 13:55
I'm not certain how to do that? Currently I am at work so I can't do it till later this afternoon.

wysota
19th March 2010, 14:34
Open the Qt command prompt, cd to the directory where the qrc file is and run rcc.exe iconeditor.qrc

goodz
19th March 2010, 19:19
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?

wysota
20th March 2010, 08:28
Please be more specific.

goodz
20th March 2010, 19:43
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.