windres 用法

windres -o resfile.o resfile.rc
gcc -o hello hello.o resfile.o -mwindows




First you need to create a .rc file that looks something like this:


id ICON "path/to/my.ico"
Well, actually, I suppose you need to create the icon first... but anyway... the ID can pretty much anything. It doesn't matter unless you want to refer to it in your code.


Then run windres as follows:


windres my.rc -O coff -o my.res
Then you just include my.res along with your object files when you link. e.g.,


g++ -o my_app obj1.o obj2.o my.res
And that should be all there is to it. Hope it helps, I spent an entire evening tracking this down last week when porting my wxwidgets program from linux to windoze...


And, at no extra charge, if you want to include version information in your application, add the following boilerplate to your .rc file and modify appropriately:


1 VERSIONINFO
FILEVERSION     1,0,0,0
PRODUCTVERSION  1,0,0,0
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "080904E4"
    BEGIN
      VALUE "CompanyName", "My Company Name"
      VALUE "FileDescription", "My excellent application"
      VALUE "FileVersion", "1.0"
      VALUE "InternalName", "my_app"
      VALUE "LegalCopyright", "My Name"
      VALUE "OriginalFilename", "my_app.exe"
      VALUE "ProductName", "My App"
      VALUE "ProductVersion", "1.0"
    END
  END


  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x809, 1252
  END
END
Note, the langID is for U.K. English (which is the closest localisation to Australia I could identify.) If you want U.S. "English" then change the BLOCK line to:


BLOCK "040904E4"
and the translation line to:


VALUE "Translation", 0x409, 1252
See here for for info.
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
'windres' 不是内部或外部命令,也不是可运行的程序或批处理文件的错误提示通常出现在使用MSVC编译OpenCV时。这个错误有几个可能的原因。首先,可能是因为所使用的MSVC编译器无法找到'windres.exe'执行文件。系统默认情况下,'windres.exe'应该在"C:\Windows\System32"路径中。如果该路径中没有'windres.exe'文件,就会出现错误提示。另一个可能的原因是'windres.exe'不支持所执行的命令或者程序位数不对。解决这个问题的方法是确保系统中存在'windres.exe'文件,并且将其正确配置到环境变量中,以便编译器可以找到该文件。还可以检查编译器是否与所使用的OpenCV版本兼容。如果问题仍然存在,可以尝试重新安装或更新MSVC编译器。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Cmake编译pencv报错汇总](https://blog.csdn.net/yyc1820252161/article/details/131805058)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [windres.exe执行错误提示‘gcc‘ 不是内部或外部命令,也不是可运行的程序或批处理文件。解决方法](https://blog.csdn.net/lizaijinsheng/article/details/120195464)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值