当前位置:网站首页>Add ICO icon to clion MinGW compiled EXE file
Add ICO icon to clion MinGW compiled EXE file
2022-07-05 20:59:00 【Hu Anmin】
Prepare for compilation
We generate it directly after normal compilation exe There is no icon
So many exe The programs have personality icons, so vs and qt Is relatively simple, but in Clion How can I add it in compilation ?
Prerequisite , This machine must be configured MinGW, And the environment variables are also added
After my own research, I found , We need to create one ico.rc
The files are placed in the root directory of the project , Then add some configuration information to this file
id ICON "logo.ico" // Add Icon
#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" // Support Chinese
BEGIN
VALUE "CompanyName", "*** Co., LTD. \0"
VALUE "FileDescription", " Software name \0"
VALUE "FileVersion", "1.0.0.10\0"
VALUE "ProductVersion", "1.0.0.10\0"
VALUE "LegalCopyright", " copyright (C) *** Co., LTD. \0"
VALUE "LegalTrademarks", "*** Co., LTD. \0"
VALUE "OriginalFilename", "version.exe\0"
VALUE "ProductName", " Software name \0"
VALUE "InternalName", "version.exe\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x804, 1200 // Language - Simplified Chinese
END
END
Fillet making , Circle making , ioc Picture making
1. compile ico.rc>ico.o
Then name the icon logo.ico
Put it in the root of the project , After that, we need to ico.rc The file is compiled as ico.o
windres -i "ico.rc" -o "ico.o"
Then there are two ways , Manual packing exe And use Clion compile exe , The following picture is the project structure and main file
2. Compile to executable exe
Manually compile
Go to the root directory of the project and
gcc module/calculate/calculate.c module/str/str.c ico.o -g -o main main.c
Be careful : module/calculate/calculate.c module/str/str.c These are all main.c The dependent files of , You need to take it with you when packing , and ico.o You need to compile into exe It doesn't take effect until it's finished
Clion compile
Then we compile , Icons and information will be added to exe It's in
effect
Want very nice icons , have access to ps Self repair
Detailed information garbled code solution
What's the problem ? This is because windows The default is ANSI code , And what we use is UTF-8 Compilation of ico.rc file
Solution use NotePad++ take ico.rc Of documents UTF-8 Code to ANSI code , then Ctrl+s
preservation
Then follow the above tutorial , take ioc.rc Recompile to ioc.o file , Then repackage the project as .exe
, The effect is as follows :
modify exe Invalid Icon
When we want to put exe Replace the icon of with another icon , Find new icons as long as they have the same name as the old icons , It will automatically become an old icon , This is because windows,ico Cache issues
terms of settlement stay cmd Just enter the command in
taskkill /im explorer.exe /f
cd /d %userprofile%\appdata\local
del iconcache.db /a
start explorer.exe
exit
边栏推荐
- MYSQL IFNULL使用功能
- Return to blowing marshland -- travel notes of zhailidong, founder of duanzhitang
- Abbkine trakine F-actin Staining Kit (green fluorescence) scheme
- 学习机器人无从下手?带你体会当下机器人热门研究方向有哪些
- 木板ISO 5660-1 热量释放速率摸底测试
- 五层网络协议
- 浅聊我和一些编程语言的缘分
- Pytorch实战——MNIST数据集手写数字识别
- Viewrootimpl and windowmanagerservice notes
- Web Service简单入门示例
猜你喜欢
Abnova fluorescent dye 620-m streptavidin scheme
Write an interface based on flask
PHP deserialization +md5 collision
Abnova丨培养细胞总 RNA 纯化试剂盒中英文说明书
使用WebAssembly在浏览器端操作Excel
2. < tag hash table, string> supplement: Sword finger offer 50 The first character DBC that appears only once
珍爱网微服务底层框架演进从开源组件封装到自研
Duchefa low melting point agarose PPC Chinese and English instructions
教你自己训练的pytorch模型转caffe(三)
2.<tag-哈希表, 字符串>补充: 剑指 Offer 50. 第一个只出现一次的字符 dbc
随机推荐
js常用方法封装
Popular science | does poor English affect the NPDP exam?
Abnova CRISPR spcas9 polyclonal antibody protocol
Abnova CD81 monoclonal antibody related parameters and Applications
《SAS编程和数据挖掘商业案例》学习笔记# 19
vant 源码解析之 utils/index.ts 工具函数
Write an interface based on flask
Material Design组件 - 使用BottomSheet展现扩展内容(二)
Influence of oscilloscope probe on measurement bandwidth
AITM2-0002 12s或60s垂直燃烧试验
Traps in the explode function in PHP
WPF gets the control in the datagridtemplatecolumn of the specified row and column in the DataGrid
Research and development efficiency improvement practice of large insurance groups with 10000 + code base and 3000 + R & D personnel
教你自己训练的pytorch模型转caffe(二)
教你自己训练的pytorch模型转caffe(一)
最长摆动序列[贪心练习]
研学旅游实践教育的开展助力文旅产业发展
Phpstudy Xiaopi's MySQL Click to start and quickly flash back. It has been solved
shell编程100例
Analysis of steam education mode under the integration of five Education