【发布时间】:2018-03-27 08:45:46
【问题描述】:
我的最终目标是设置使用 MinGW gcc-g++ 编译的可执行文件的版本(显示在属性->详细信息中)。但是现在我想用windres编译一个资源文件,以便以后手动链接它。但是当我使用此命令时出现以下错误:windres resource.rc -o resource.res:
windres: resource.rc:2: syntax error
The process tried to write to a nonexistent pipe.
...
The process tried to write to a nonexistent pipe.
resource.rc:4:0: fatal error: when writing output to : Invalid argument
VS_VERSION_INFO VERSIONINFO
compilation terminated.
windres: preprocessing failed.
我的 resource.rc 看起来像这样:
#include "winver.h"
#include "../include/resource.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,0,0,2
PRODUCTVERSION 0,0,0,2
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
{
BLOCK "StringFileInfo"
{
BLOCK "040904b0"
{
VALUE "Comments", "comment\0"
VALUE "CompanyName", "comment\0"
VALUE "FileDescription", "base file\0"
VALUE "FileVersion", "0.0.0.2 TP\0"
VALUE "InternalName", "testTP\0"
VALUE "LegalCopyright", "none\0"
VALUE "OriginalFilename", "test.exe\0"
VALUE "ProductName", "test\0"
VALUE "ProductVersion", "0.0.0.2 TP\0"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x409, 1200
}
}
而我的 resource.h 只是空的,也许这就是问题所在?让我惊讶的是,在 exe 的属性选项卡中简单地设置版本号是多么复杂。我一直在阅读很多其他 SO 答案,但没有一个对我有用。例如this one 在拥有这个 resource.rc 文件后如何准确地进行似乎太模棱两可了。
【问题讨论】: