PDA

View Full Version : Resources do not show up in release mode ?!



ThomasBrown
18th March 2010, 23:19
Hi,

until now I thought I am quite an experienced QT user, but the following thing kills me:

I have added some icons as a resource in the file XXX.qrc. If I compile in debug mode, everything goes fine and the icons are shown in the GUI.

However, if I compile in release mode, the symbols do not show up.

What's going on???

Thanks for your help,
Thomas

wysota
19th March 2010, 09:14
It might be a long shot but are you sure you are using the resources in your code and not referencing real files? Also what is the file type of the icons? Are they PNG or some other format?

Bitto
19th March 2010, 11:32
Hi,
However, if I compile in release mode, the symbols do not show up.


Are you using Q_INIT_RESOURCE? Sometimes smart linkers will remove all the resources from your binaries because they are not referenced.

ThomasBrown
25th March 2010, 21:42
Hey guys,

the problem was the type of my resource. Obviously, Qt does not like *.ico files. I converted them to png's and everything is fine now.

Thanks,
Thomas

ChrisW67
25th March 2010, 23:23
Your release code, in its release environment, may have been missing the image format plugin for ICO.

davidpiedra
9th April 2010, 16:46
I have a similar problem maybe you could help. I design a form in the designer and add a resource file with 2 jpeg images to display in the form, just 2 logos. I add the form to the project and the qrc file, now when I compile in debug mode everything woks fine the logos show, but when I create a release do not show. I put the Q_INIT_RESOURCE macro but I get and error "./main.o:main.cpp::-1: error: undefined reference to `qInitResources_pics()'", I've copy all the pictures and plugins to the release directory and it's the same.

I'm starting with QT4 I used QT3 in the past but things are diferent now!!

Please help.

EDIT: I test putting the program in another machine with no qt installed, the application runs fine but still not showing the pictures, but if I put the exe in the Debug directory of the developer machine, in the intallation directory of the new machine it works, the images are displaying.:confused:

wysota
9th April 2010, 21:05
http://www.qtcentre.org/faq.php?faq=qt_images#faq_qt_images_relative_path
http://www.qtcentre.org/faq.php?faq=qt_images#faq_qt_missing_images

davidpiedra
14th April 2010, 15:35
Thanks wysota for your reply, but I already try this, the odd thing is that the images didn't display even in the developer machine when I deploy the release, when I am in debug mode they show ok and I'm using a Resource to keep the images in the proyect.

A= developer machine
B=production machine (no qt installed)

About the plugins, I tried putting the plugins in all possible directories and nothing, as I said if I copy the exe in the debug directory of A to install directory in B, with the plugins in plugins/imageformats it work ok, but the exe in the release directory not in either A nor B.

Thanks.

David

Update: Should I pul in the pro file a line to tell Qt to add the pics in the exe? Because when I make a release with or without the pics the exe size it's the same, but when I am in debug mode the exe that creates goes down a few kb if I remove the pictures, this should happen in the release exe too?

wysota
14th April 2010, 15:59
You should have a RESOURCES+=filenamewithyourimages.qrc line in your project file.

davidpiedra
14th April 2010, 16:15
yes I do, here's my .pro file:

#TEMPLATE = app
#TARGET = release/reloj
#DEPENDPATH += . \
# ./debug \
# ./resources
#INCLUDEPATH += .
#CONFIG = qt release

HEADERS += dsptiempo.h \
reloj.h \
marca.h \
dbinfo.h \
qlneedtnum.h \
qpshbtnnum.h
FORMS += principal.ui
SOURCES += dsptiempo.cpp \
reloj.cpp \
main.cpp \
marca.cpp \
qpshbtnnum.cpp \
qlneedtnum.cpp
RESOURCES += ./resources/fotos.qrc
QT += sql

Like this the exe is created in the debug directory, if I remove the # in the first lines the release is created, well of course you probably know this because you're a Master of Zen!!!;)

Thanks