【问题标题】:generate .res borland resource file生成 .res borland 资源文件
【发布时间】:2017-12-19 21:15:15
【问题描述】:

经过大量挖掘,我终于遇到了这个线程:Does the .res file need to be in source control?,我们从一开始就没有将它包含在 git 中。现在我正在尝试从命令行从源代码构建项目。如果我在 Borland 中打开文件,它会要求我重新创建所述文件,然后我可以开始制作项目。如果我删除所有生成的文件并 rake,我会得到以下输出(为了清楚起见,分解了 ruby​​ 任务)

$ bpr2mak_exe="#{ENV['BCB']}\\Bin\\bpr2mak.exe"
$ make_exe="#{ENV['BCB']}\\Bin\\make.exe"
$ puts `#{bpr2mak_exe} -omakefile MyProject.bpr`
Loading project file
Loading template
Generating Makefile
.........................................

& puts `#{make_exe} -fmakefile`
MAKE Version 5.2  Copyright (c) 1987, 2000 Borland
Fatal: 'MyProject.res' does not exist - don't know how to make it

我查看了所有命令行工具(专注于 BRCC32.exe 和 GRC32.exe),但它们看起来都不像我需要的。我还尝试使用 procmon 来查看调用了什么程序来生成 res 文件。所以你们中的任何一个 Borland/Embarcado 人都想要管道吗? (如果有帮助,这里是命令行帮助屏幕)

$ "${BCB}\bin\BRC32.exe" -?

Syntax: BRC32 [options ...] filename
options marked with a '*' are on by default

-r                    compile only. Do not bind resources
-fofilename           set output res filename
-fefilename           set output exe filename
-v                    verbose
-ipath                set include path
-x                    ignore INCLUDE environment variable
-dname[=string]       define #define
-32                *  build 32-bit Windows compatible res/exe files
-16                   build 16-bit Windows compatible res/exe files
-Vd.d Mark the .exe file with Windows version provided (4.0 is the default)
-31  Provided for downward compatibility (build 16-bit res/exe files)
-w32 Provided for downward compatibility (build 32-bit res/exe files)
-k                    do not create fastload area (16 bit only)
-t                    (ignored, for compatibility)
-? or -h              display this message

$ "${BCB}\bin\BRCC32.exe" -?
Borland Resource Compiler  Version 5.40
Copyright (c) 1990, 1999 Inprise Corporation.  All rights reserved.

Syntax: BRCC32 [options ...] filename
options marked with a '*' are on by default

@<filename>        Take instructions from command file
-r                    (ignored for compatibility)
-16                   Build 16-bit Windows compatible .res file
-32                 * Build 32-bit Windows compatible .res file
-fofilename           Set output filename
-v                    Verbose
-ipath                Set include path
-dname[=string]       Define #define
-x                    Ignore INCLUDE environment variable
-m                    Enable multi-byte character support
-cdddd                set default code page to nnnn
-lxxxx                set default language to xxxx
-31   Provided for downward compatibility (build 16-bit .res file)
-w32  Provided for downward compatibility (build 16-bit .res file)
-? or -h              Display this message

只是为了好玩,我尝试针对项目文件运行它们

$ "${BCB}\bin\BRC32.exe" -r MyProject.bpr

Borland Resource Compiler  Version 5.40
Copyright (c) 1990, 1999 Inprise Corporation.  All rights reserved.

Error MyProject.bpr 1 1: Expecting resource name or resource type name

$ "${BCB}\bin\BRCC32.exe" -r MyProject.bpr
Borland Resource Compiler  Version 5.40
Copyright (c) 1990, 1999 Inprise Corporation.  All rights reserved.

Error MyProject.bpr 1 1: Expecting resource name or resource type name

【问题讨论】:

    标签: makefile borland-c++


    【解决方案1】:

    IDE(而非编译器)使用从项目文件中提取的版本信息生成默认的.res 文件。对于您尝试进行命令行编译的内容,最好使用所需的资源数据定义创建自己的.rc 脚本文件,然后使用brcc32 将其编译为.res 文件,然后您可以用ilink32链接到它。

    但是,您真的不应该使用make 来编译Borland 项目。使用 Borland 的 bcc32 编译器或 MS 的 msbuild 框架(取决于您的 C++Builder 版本)并让它处理 make 会做的所有事情。然后您可以编译您的.bpr.cproj 文件,而无需先将其转换为.mak 文件。

    【讨论】:

    • 如果我错了请纠正我,但我喜欢使用 bpr2mak.exe 创建 make 文件的原因是因为它会选择包含的任何新类(单元)。仍然可以仅使用 bcc32 编译器来处理吗?
    • 单元引用存储在.bpr/.cproj 文件中。 bcc32 会在每次运行时解析文件时提取它们,只要您编译的是项目本身而不是单个文件。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多