Add Icon To Your Exe in C/C++

Ever wondered how to add an icon to your final executable? I’ll explain here how you can easily do it!

You will have to create your icon first. It should not be so hard, just google “icon creator” and you’ll find plenty of stuff to freely create your icons. Sizes must be 16×16, 32×32, 48×48, etc.. and file extension ico.

Once that is done, you just have to go to your C/C++ project, I honestly don’t know for other languages, but I’m sure it won’t be that different, and add a resource file.

Create new File with *.rc extension

File Tree

What can we add to the rc file?
You can add files that will be added to the resulting exe file after compilation. You can merge icons, bitmaps, cursors etc… The first icon in your file will represent the exe icon so in your file write.

The code you will enter has 3 parts, the first is an ID, every resource must have an ID, second is the type, third is the name.
This simple code will had the icon named filename.ico to the program executable.

1 ICON "filename.ico"

and on compilation time, your exe will have the icon :D
end result
That is all. :)
Enjoy.

This entry was posted in Tutorials. Bookmark the permalink.

One Response to Add Icon To Your Exe in C/C++

  1. Great blog guys, lovin it.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WP Hashcash