编译前准备
1.编译ico.rc>ico.o
将图标放到工程目录下
新建ico.rc文件
id ICON "spoon.ico" //添加图标
#include <winver.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,10
PRODUCTVERSION 1,0,0,10
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080404b0" //支持中文
BEGIN
VALUE "CompanyName", "***有限公司\0"
VALUE "FileDescription", "软件名称\0"
VALUE "FileVersion", "1.0.0.10\0"
VALUE "ProductVersion", "1.0.0.10\0"
VALUE "LegalCopyright", "版权所有 (C) ***有限公司\0"
VALUE "LegalTrademarks", "***有限公司\0"
VALUE "OriginalFilename", "version.exe\0"
VALUE "ProductName", "软件名称\0"
VALUE "InternalName", "version.exe\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x804, 1200 //语言-简体中文
END
END
编译为ico.o文件
windres -i "ico.rc" -o "ico.o"
将ico.o文件添加到CmakeLists文件中
Clion编译后查看exe文件图标