In Windows, using mingw's gcc, is there anyway to specify that the output exe file is to take an icon file, so that the exe file shows with that icon in explorer?
Windows – How to add an icon to a mingw-gcc compiled executable
gcciconsmingwwindows
Related Question
- Html – How to add a browser tab icon (favicon) for a website
- Why doesn’t GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)
- C++ – Debug vs Release in CMake
- Java – Can’t start Eclipse – Java was started but returned exit code=13
- Python – fatal error: Python.h: No such file or directory
- Windows – Filename too long in Git for Windows
- C++ – Compiling an application for use in highly radioactive environments
Best Solution
You need to create the icon first. Then you need to create a RC file with the below content. Here we'll name it as
my.rc
.The
id
mentioned in the above command can be pretty much anything. It doesn't matter unless you want to refer to it in your code. Then run windres as follows:Then while building the executable, along with other object files and resource files, include
my.res
which we got from the above step. e.g.:And that should be all there is to it.
And, at no extra charge, if you want to include version information in your application, add the following boilerplate to a new
.rc
file and follow the above mentioned steps.Note, the langID is for U.K. English (which is the closest localisation to Australia I could identify.) If you want U.S. "English" then change the
BLOCK
line to:and the translation line to:
See VERSIONINFO resource for for info.