Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Adding an icon in mingw?

  1. Feb 4, 2009 #1
    Okay, here's one.

    - I'm developing a program for macintosh+windows.
    - But, I myself am on a macintosh.
    - So, I installed MinGW on my mac. Now, I can compile Windows .exes sitting here on my macintosh. (This part already works.)
    - But I can't figure out: How do I give my program an icon?

    I have here a .ico I made, but I don't know how to associate it with or embed it into my Windows .exe. I don't really know how Windows icons work. Is there a way to do this using mingw or any open source tool I can run on my mac? (I.E. what I'm trying to do somehow prep the exe is so that when I zip it up and send it over to a windows machine, the windows user will see the icon immediately.)
  2. jcsd
  3. Feb 6, 2009 #2


    User Avatar

    It is a GUI app or Console app?
    You should try some windows API function such as LoadIcon. You should read books such as <<windows programming>> by Charles Petzold.
  4. Feb 6, 2009 #3
    It is a normal type gui app.

    I'm not sure what you mean about the API? I don't mean I want to change the icon at runtime, I mean like I want some file to be the program's icon even before it launches and I can't do the normal thing of right click->properties because I'm not actually on windows myself.
  5. Feb 7, 2009 #4


    User Avatar

    Oh, I'm using code::blocks and Mingw under windows, so, with application wizard, it is easy to generate a gui application.
    You can use include an icon file as it's resource file.
    That all I know.
  6. Feb 7, 2009 #5
    OK. Thanks for the help.

    It turns out that the correct answer if you're limited to the command line tools is to http://www.cyrocom.co.uk/tutorials/cpp/icon.html [Broken]. I got it working using this.
    Last edited by a moderator: May 4, 2017
  7. Apr 27, 2009 #6
    Hi. Actually the http://blog.stranadurakov.com/2009/04/27/icon-and-version-information-resource-file/" [Broken] is pretty easy.
    Last edited by a moderator: May 4, 2017
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Adding an icon in mingw?