This repository is a example of adding a icon to an .exe program, is base on the following anwser in stackoverflow and is based using gcc instead of MSVC
First we need a .ico with support for more than one layer,with sizes, 128x128, 64x64, 32x32 and 16x16,
I created the ico using gimp
Then, we need a program call windres, which compiles windows resource files, and we add to resource.rc the following MAINICON ICON "xterm.ico"
.
Then we may build the resource file using windres
$ windres resource.rc resource.o
Then, we just need to add the resource.o to the compiler.
$ gcc -o main.exe main.c resource.o