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?
To open a project From the File menu select Open. From the Files of type: in the window, select “Code::Blocks project files” and then select the . cbp file pertaining to your program. Press Open when done.
On all plans, code blocks support plain text, HTML, Markdown, and CSS code surrounded by <style></style> tags.
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.
File -> New -> Empty File
and name it icon.rc
. It has to be visible in the Workspace/Project otherwise CodeBlocks will not be aware of this file. It will show up there in a project folder called Resources
. MAINICON ICON "filename.ico"
. MAINICON is just an identifier, you can choose something different. More info 1 & More info 2. 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With