Board index » cppbuilder » It's the .rc file

It's the .rc file


2005-07-01 01:55:29 AM
cppbuilder79
It turns out that it was nothing about using a project group at all.
Rather, it was the inclusion in the project of an RC file separate
from the one the IDE makes for you.
When an RC file is added explicitly to the project, both Project|Build
and Project|Make will compile a RES from the RC if necessary; however,
Build will not link the resources into an updated EXE, and Make will
only produce an EXE if the RES file was already up-to-date compared to
the RC file. Bottom line is the IDE doesn't seem to know where to go
after doing an RC-to-RES compilation.
The (partial) solution, then, to getting Build to work right and
produce an EXE is to remove the RC from the project. There seem to be
two approaches to getting the resources into the final EXE after doing
this, both of which require manually compiling the RC to RES using
BRCC32 on the command line (that's why I said 'partial' solution).
1. JD mentioned (in another thread) that he adds the following to his
unit:
#include "MyResource.rh"
#pragma resource "MyResource.res"
With my current project, this approach gets Build to produce an EXE
with the RES file linked in. (thanks to JD)
2. It is also possible to get Build to work properly by explicitly
adding the RES file to the project (leaving out the two lines in the
first approach).
Both approaches seem to give equivalent results, and both require
manual compiling of the RC, so it's a matter of preference.
Thought some might find this of interest.
-- salamander
 
 

Re:It's the .rc file

"salamander1965" < XXXX@XXXXX.COM >wrote in message
Quote
When an RC file is added explicitly to the project, both Project|Build
and Project|Make will compile a RES from the RC if necessary; however,
Build will not link the resources into an updated EXE, and Make will
only produce an EXE if the RES file was already up-to-date compared to
the RC file. Bottom line is the IDE doesn't seem to know where to go
after doing an RC-to-RES compilation.

The (partial) solution, then, to getting Build to work right and
produce an EXE is to remove the RC from the project. There seem to be
two approaches to getting the resources into the final EXE after doing
this, both of which require manually compiling the RC to RES using
BRCC32 on the command line (that's why I said 'partial' solution).

1. JD mentioned (in another thread) that he adds the following to his
unit:

#include "MyResource.rh"
#pragma resource "MyResource.res"

With my current project, this approach gets Build to produce an EXE
with the RES file linked in. (thanks to JD)

2. It is also possible to get Build to work properly by explicitly
adding the RES file to the project (leaving out the two lines in the
first approach).

Both approaches seem to give equivalent results, and both require
manual compiling of the RC, so it's a matter of preference.

Thought some might find this of interest.
I am not sure what precipitated your message (I have not seen the original
thread you referred to), but I suspect you are talking about the (BCB6) bug
where building a project that contains RC files will cause the build to
abort when an RC file is encountered (which, I suppose, may manifest itself
as appearing as if the RES files are not getting linked).
Adding the RES file to the project (either explicitly or via pragma) and
manually building the RC file is a poor workaround, and definitely not
necessary.
The cause of this problem is due to a bug in the IDE (BCB6 only, not BCB5)
in which it adds RC files to the project incorrectly. When you add a new RC
file to your project, the IDE adds a line like the following to your BPR
file:
<FILE FILENAME="MyResource.rc" FORMNAME="" UNITNAME="MyResource.rc"
CONTAINERID="RC" DESIGNCLASS="" LOCALCOMMAND=""/>
If you try to build this project from the IDE, there is a good chance the
IDE will abort the build when it encounters the RC file. To correct this,
you need to change the CONTAINERID value from "RC" to "RCCompiler":
<FILE FILENAME="MyResource.rc" FORMNAME="" UNITNAME="MyResource.rc"
CONTAINERID="RCCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
(which, of course, is what the IDE should have done in the first place!)
If you make this change, the IDE will build your project correctly, and you
will not have to compile anything manually, or add RES files to your
project.
- Dennis
 

Re:It's the .rc file

Quote
I am not sure what precipitated your message (I have not seen the original
thread you referred to), but I suspect you are talking about the (BCB6) bug
where building a project that contains RC files will cause the build to
abort when an RC file is encountered (which, I suppose, may manifest itself
as appearing as if the RES files are not getting linked).
Yes, I think we're talking about the same thing. I saw a number of
articles at www.tamaracka.com that talked about the problem with RC
files in a project, and while I saw a lot that makes me think that's
what I was experiencing, I don't recall seeing any good resolutions
for the problem, certainly not the one you described here (I admit, I
may have missed it).
The thread I referred to is:
[vcl.components.using - 6/29/05 @ 11:45 'Main form will not minimize'
(just in case I didn't include the thread link correctly)]
The subject is a little misleading since the thread has evolved
(thanks to JD) from diagnosing a general symptom to trying to narrow
down causes.
Thanks for the information -- salamander
 

{smallsort}