当前位置:网站首页>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
边栏推荐
- Abnova blood total nucleic acid purification kit pre installed relevant instructions
- WPF gets the control in the datagridtemplatecolumn of the specified row and column in the DataGrid
- LeetCode: Distinct Subsequences [115]
- Duchefa d5124 md5a medium Chinese and English instructions
- haas506 2.0开发教程 - 阿里云ota - pac 固件升级(仅支持2.2以上版本)
- vant 源码解析之 utils/index.ts 工具函数
- XML modeling
- Binary search
- Viewrootimpl and windowmanagerservice notes
- php中explode函数存在的陷阱
猜你喜欢
随机推荐
Mathematical analysis_ Notes_ Chapter 9: curve integral and surface integral
Abnova丨培养细胞总 RNA 纯化试剂盒中英文说明书
请查收.NET MAUI 的最新学习资源
Using webassembly to operate excel on the browser side
基於flask寫一個接口
Duchefa cytokinin dihydrozeatin (DHZ) instructions
Abbkine trakine F-actin Staining Kit (green fluorescence) scheme
五层网络协议
解析创客教育的知识迁移和分享精神
Viewrootimpl and windowmanagerservice notes
教你自己训练的pytorch模型转caffe(二)
vant 源码解析 之深层 合并对象 深拷贝
Interpreting the daily application functions of cooperative robots
The reason why the ncnn converted model on raspberry pie 4B always crashes when called
教你自己训练的pytorch模型转caffe(一)
LeetCode: Distinct Subsequences [115]
Wanglaoji pharmaceutical's public welfare activity of "caring for the most lovely people under the scorching sun" was launched in Nanjing
Maker education infiltrating the transformation of maker spirit and culture
wpf 获取datagrid 中指定行列的DataGridTemplateColumn中的控件
haas506 2.0开发教程 - 阿里云ota - pac 固件升级(仅支持2.2以上版本)