Windows上的GCC:设置“描述” C可执行文件的字段? [英] GCC on Windows: Set "Description" field of C executable?

查看:172
本文介绍了Windows上的GCC:设置“描述” C可执行文件的字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置可执行文件的描述属性?通过这个,我的意思是在Windows资源管理器中右键单击可执行文件时显示的值,并且它显示说明:,似乎只是没有文件扩展名的可执行文件的名称。



我在Windows XP上运行GCC 3.4.5(mingw-vista特殊版本r3)。



我已经用google搜索了这个无济于事,但我有一种感觉,我可能不得不使用windres的资源文件...我至少在正确的轨道上吗?



我实际上已经设置了一个自定义名称为-o,但实际上我完全需要一个不同的名称。 这些信息来自版本信息资源。 Windows可执行文件可以包含嵌入在其中的资源文件。通常,使用Microsoft Visual Studio创建资源脚本( .rc 文件),Visual Studio资源编译器将为您编译为可执行文件。 VS还包含一个很好的可视化资源编辑器,用于编辑各种类型的资源(字符串表,图标,位图,光标,菜单,对话框,版本信息等)。



<使用GCC,你必须自己创建资源脚本。有关<$ c的更多信息,请参阅 MSDN $ c> VERSIONINFO 资源类型。一旦你创建了一个有效的资源脚本,你可以使用 windres 来编译它到一个目标文件( .o )。 这个页面就是一个很好的例子。最后,一旦你有一个目标文件,你可以像往常一样将它与其他目标文件链接起来。


How does one set the "Description" property of an executable? By this I mean the value displayed when you right-click an executable in Windows Explorer and it shows "Description:" with what seems to be just the name of the executable without the file extension.

I'm running GCC 3.4.5 (mingw-vista special r3) on Windows XP.

I have googled the heck out of this to no avail, but I have a feeling I might have to use a resource file with windres... am I on the right track at least?

I actually have been setting a custom name with -o, but I actually want a different one altogether.

解决方案

That information is taken from a Version Info resource. Windows executables can contain resource files embedded in them. Normally, with Microsoft Visual Studio, you create a resource script (.rc file), and the Visual Studio resource compiler will compile it into the executable for you. VS also contains a nice visual resource editor for editing the various types of resources (string tables, icons, bitmaps, cursors, menus, dialog boxes, version info, etc.).

With GCC, you'll have to create the resource script yourself. See MSDN for more info on the VERSIONINFO resource type. Once you've created a valid resource script, you can use windres to compile it into an object file (.o). This page has a good example of how to do that. Finally, once you have an object file, you just link it in with the rest of your object files as usual.

这篇关于Windows上的GCC:设置“描述” C可执行文件的字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆