Results 1 to 10 of 10

Thread: Resources do not show up in release mode ?!

  1. #1
    Join Date
    Mar 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Resources do not show up in release mode ?!

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Resources do not show up in release mode ?!

    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?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2006
    Location
    Norway
    Posts
    124
    Thanked 38 Times in 30 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Resources do not show up in release mode ?!

    Quote Originally Posted by ThomasBrown View Post
    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.
    Bitto / Andreas Aardal Hanssen - andreas dot aardal dot hanssen at nokia
    Nokia Software Manager, Qt Development

  4. #4
    Join Date
    Mar 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Resources do not show up in release mode ?!

    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

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Resources do not show up in release mode ?!

    Your release code, in its release environment, may have been missing the image format plugin for ICO.

  6. #6
    Join Date
    Feb 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Resources do not show up in release mode ?!

    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.
    Last edited by davidpiedra; 9th April 2010 at 17:12. Reason: TESTING

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

  8. #8
    Join Date
    Feb 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Resources do not show up in release mode ?!

    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?
    Last edited by davidpiedra; 14th April 2010 at 15:57. Reason: Update

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Resources do not show up in release mode ?!

    You should have a RESOURCES+=filenamewithyourimages.qrc line in your project file.

  10. #10
    Join Date
    Feb 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Resources do not show up in release mode ?!

    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

Similar Threads

  1. Debug or Release mode in MAC
    By ssaa in forum Installation and Deployment
    Replies: 6
    Last Post: 9th March 2010, 05:15
  2. Replies: 1
    Last Post: 2nd November 2009, 12:02
  3. Replies: 9
    Last Post: 15th April 2009, 06:23
  4. Replies: 8
    Last Post: 10th October 2007, 18:20
  5. Release mode issue
    By stevey in forum Qt Programming
    Replies: 2
    Last Post: 8th November 2006, 20:26

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.