MinGW 环境下 给hello.exe 自定义一个图标

1、新建文本文件img.rc,写入以下内容

A ICON "img.ico"

2、生成img.res文件

windres -i img.rc --input-format=rc -o img.res -O coff

3、将img.c编译成hello.o文件

gcc -c -o hello.o hello.c

4、连接成exe文件

gcc hello.o img.res -o hello.exe

原文链接:http://liuzhen8346.blog.163.com/blog/static/10583925201143015352377/

原文地址:https://www.cnblogs.com/ligongzi/p/2664097.html