Error while trying to set exe icon



  • Hello, I am trying to set my custom icon for my application but it gives me that error:
    @
    :-1: error: [release/testicon_res.o] Error 1
    @
    I am following that example:
    @
    win32:RC_FILE += testicon.rc
    @

    I have the testicon.rc and testicon.ico in my parent folder.
    @
    IDI_ICON1 ICON DISCARDABLE "/home/ilian/QT5/MathForFun/testicon.ico"
    @
    The paths are correct. Any Info?
    P.S. I am using MinGW qtcreator under wine. Not the latest, pre-latest ver. Sorry, not good with numbers. 5.3.1 I think.


  • Lifetime Qt Champion

    Hi,

    When using a rc file I just give the name of the icon and ensure that it's in the same folder as the ico file.

    Hope it helps



  • Yes, it actually ran, but the executale is not with the icon, I`ve sat...
    [quote author="SGaist" date="1420410010"]Hi,

    When using a rc file I just give the name of the icon and ensure that it's in the same folder as the ico file.

    Hope it helps[/quote]


  • Lifetime Qt Champion

    What version of windows is it ?


  • Moderators

    I'm with SGaist on this one, I usually just do:

    @

    pro file

    RC_FILE += app.rc
    @

    @

    app.rc

    IDI_ICON1 ICON DISCARDABLE "my.ico"
    @

    Using a hardcoded path pretty much anywhere in code is a bad idea. Especially if it is to your home dir. But hardcoded paths in general are bad.

    Also, I tend to include my icon in a Qt resource file (.qrc) as well. Then make sure I call setWindowIcon(QIcon(":/res/myicon.png")); in the QApplication.


Log in to reply
 

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