GCC on Windows: set the "Description" field of the C executable?

How to set the Description property for an executable file? By this I mean the value displayed when you right-click on an executable file in Windows Explorer, and it shows "Description:" with what looks like the name of an executable file without a file extension.

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

I have a googled heck from this to no avail, but I have a feeling that I might have to use a resource file with windres ... Am I at least on the right path?

I actually set my own name with -o, but I really want a completely different one.

+4
source share
2 answers

This information is taken from the version information resource. Windows executables may contain resource files embedded in them. Typically, a script resource ( .rc file) is created in Microsoft Visual Studio, and the Visual Studio Resource Compiler compiles it into an executable for you. VS also contains a beautiful visual resource editor for editing various types of resources (string tables, icons, bitmaps, cursors, menus, dialog boxes, version information, etc.).

With GCC, you will need to create the script resource yourself. See MSDN for more information on the resource type VERSIONINFO . When you have created a valid script resource, you can use windres to compile it into an object ( .o ) file. This page has a good example of how to do this. Finally, as soon as you have an object file, you simply link it to the rest of the object files, as usual.

+8
source

Yes, you need a resource file.

Windows versions of gcc (MinGW, Cygwin) come with a tool called windres. This will compile the resource files into object files for inclusion in the build phase. As a simple example, to compile the file "chocolate-doom-res.rc":

 windres chocolate-doom-res.rc chocolate-doom-res.o 

This gives you a ".o", which you can easily add to your assembly, for example.

 gcc other.o files.o etc.o chocolate-doom-res.o -o chocolate-doom.exe 
+7
source

All Articles