当前位置:网站首页>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
边栏推荐
- Is it safe to open a stock account by mobile phone? My home is relatively remote. Is there a better way to open an account?
- Write an interface based on flask
- 基于vertx-web-sstore-redis的改造实现vertx http应用的分布式session
- Analyze the knowledge transfer and sharing spirit of maker Education
- Pytorch实战——MNIST数据集手写数字识别
- 获取前一天的js(时间戳转换)
- Generics of TS
- Abnova cyclosporin a monoclonal antibody and its research tools
- Duchefa cytokinin dihydrozeatin (DHZ) instructions
- How to make ERP inventory accounts of chemical enterprises more accurate
猜你喜欢
浅聊我和一些编程语言的缘分
Duchefa s0188 Chinese and English instructions of spectinomycin hydrochloride pentahydrate
Abnova e (diii) (WNV) recombinant protein Chinese and English instructions
学习机器人无从下手?带你体会当下机器人热门研究方向有哪些
研学旅游实践教育的开展助力文旅产业发展
Talk about my fate with some programming languages
【案例】元素的显示与隐藏的运用--元素遮罩
教你自己训练的pytorch模型转caffe(一)
实现浏览页面时校验用户是否已经完成登录的功能
木板ISO 5660-1 热量释放速率摸底测试
随机推荐
台风来袭!建筑工地该如何防范台风!
序列联配Sequence Alignment
Clion-MinGW编译后的exe文件添加ico图标
中国的软件公司为什么做不出产品?00后抛弃互联网;B站开源的高性能API网关组件|码农周刊VIP会员专属邮件周报 Vol.097
Implementation of redis unique ID generator
大二下个人发展小结
显示屏DIN 4102-1 Class B1防火测试要求
leetcode:1755. 最接近目标值的子序列和
wpf 获取datagrid 中指定行列的DataGridTemplateColumn中的控件
SYSTEMd resolved enable debug log
vant 源码解析 之深层 合并对象 深拷贝
vant 源码解析之 utils/index.ts 工具函数
Open source SPL eliminates tens of thousands of database intermediate tables
Monorepo管理方法论和依赖安全
poj 3414 Pots (bfs+线索)
Maker education infiltrating the transformation of maker spirit and culture
Comparison table of foreign lead American abbreviations
Binary search
概率论机器学习的先验知识(上)
显示器要申请BS 476-7 怎么送样?跟显示屏一样吗??