Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error while trying to set exe icon
Qt 6.11 is out! See what's new in the release blog

Error while trying to set exe icon

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    heatblazer
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • H Offline
        H Offline
        heatblazer
        wrote on last edited by
        #3

        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]

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What version of windows is it ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • A Offline
            A Offline
            ambershark
            wrote on last edited by
            #5

            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.

            My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved