Robert Snyder
Robert Snyder

Reputation: 2409

generate .res borland resource file

after much digging i finally came accross this thread: Does the .res file need to be in source control? which we never included it in git from the get go. Now I'm trying to build the project from the source from the command line. If i open the file in Borland it will ask me to recreate said file and I can go about making the project. If I delete all generated files and rake I get the following output (exploded the ruby task for clarity)

$ 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

I looked at all the command line tools (focused on BRCC32.exe and GRC32.exe) and neither of them look like what I need. I also tried using procmon to see what program is called to generate the res file. So any of you Borland/Embarcado people want to pipe up? (here are the command line help screens if it helps)

$ "${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

and just for fun I tried running them against the project file

$ "${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

Upvotes: 1

Views: 1985

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 596206

The IDE, not the compiler, generates the default .res file using version information extracted from the project file. For what you are attempting for a command-line compilation, you are better off creating your own .rc script file with the required resource data definitions, and then compile that to a .res file using brcc32, and then you can link to it with ilink32.

But, you really shouldn't be using make to compile a Borland project to begin with. Use Borland's bcc32 compiler, or MS's msbuild framework (depending on your version of C++Builder) and let it handle everything that make would do. Then you can compile your .bpr or .cproj file without having to convert it to a .mak file first.

Upvotes: 2

Related Questions