Setting up icon for exe-files in qt 4.8.1



  • hello,

    i try to set up an icon file for the exe file, but its not working. under windows.
    i add
    @
    win32: RC_FILE += printer.rc
    @

    to printer.pro project file

    and add a

    printer.ico file
    and a
    printer.rc file with this line:

    @
    IDI_ICON1 ICON DISCARDABLE "robbie20_obj.ico"
    @

    the compiling error (under release and debug)

    @
    :-1: Error:[c:/.../printer_obj_res.o] Error 1
    @
    any idea why this occures?

    thanks in advance



  • Why do you use DISCARDABLE declaration?
    any way, you should show more line of compiler error. With just one line is hard to say something over then "you have an error in resources".

    And why you use "robbie20_obj.ico" if you has added printer.ico?



  • hi,
    DISCARDABLE because of here:

    http://doc.qt.nokia.com/4.7-snapshot/appicon.html

    yes, sry too much c&p

    there is no robbie20_obj.ico, only printer.ico, i tried to copy and paste it out of an old orphan dead project.

    @
    windres: c:\Users\me\QT\printer\debug\printer_res.o: No such file or directory
    mingw32-make.exe[1]: *** [c:/Users/me/QT/printer/debug/printer_res.o] Error 1
    mingw32-make.exe: *** [debug] Error 2
    11:30:37: Der Prozess "C:\QtSDK\mingw\bin\mingw32-make.exe" wurde mit dem Rückgabewert 2 beendet.
    Fehler beim Erstellen des Projekts printer(Ziel: Desktop)
    Bei der Ausführung von Build-Schritt 'Make'
    @



  • It looks like windres can't find generated object file from .rc(?) or maybe generated object file from .h(?)... Maybe it is saved elsewhere then c:\Users\me\QT\printer\debug. Try to search for printer_res.o or maybe for printer.o

    You can try to manually genereate object file from resource too:
    @windres.exe printer.rc printer_res.o @
    Try it



  • thanks
    where do i find this exe.

    a way for me to compile it is to compile it without the line
    @
    IDI_ICON1 ICON DISCARDABLE "robbie20_obj.ico"
    @

    and then i copy the
    C:\Users\me\QT\printer-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Release\release folder into

    C:\Users\me\QT\printer

    then add the line again and it works, but its not confortable for use, isn't there a nicer way?
    like this it find all files it needs to compile.



  • Something is wrong with the paths in your Makefile. If it doesn't build with the shadow build, build it directly in printer folder.

    windres.exe should be in the mingw bin path.



  • the point is that sometimes i build static release and sometimes during development, i build shared debug.

    so everything in one folder would be chaos.
    where can i check the makefile.
    this error happens for both cases, static release and shared debug.



  • Just open your Makefile and check each executable command where.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.