cwindowsiconscodeblocksresource-files

CodeBlocks - How to add an icon to a C program?


I have a small C console program and I want to add an .ico file to it, so that the executable looks nice.

How can I do this in CodeBlocks with MinGW/gcc?


Solution

  • I could not find relevant help via google that a total beginner (like me for C) could follow, so I will Q&A this topic.

    What will happen now, is windres.exe (the Resource Compiler) compiling the resource script icon.rc and the icon to an object binary file to obj\Release\icon.res. And the linker will add it to the executable.

    It's so easy yet it took me quite a while to find it out - I hope I can save someone else having the same problem some time.