# Building with Borland C++ Builder5

**URL:** https://www.finalbuilder.com/forums/t/building-with-borland-c-builder5/301
**Category:** Discussion
**Created:** [January 9, 2007, 4:28am UTC](https://www.finalbuilder.com/forums/t/building-with-borland-c-builder5/301 "2007-01-09T04:28:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rhunter2](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/r/bc79bd/32.png) [@rhunter2](https://www.finalbuilder.com/forums/u/rhunter2)
#### Post date: [January 9, 2007, 4:28am UTC](https://www.finalbuilder.com/forums/t/building-with-borland-c-builder5/301/1 "2007-01-09T04:28:06Z")

</div>

Hi all,  
  
I have been attempting to use FinalBuilder (v.4.2.0.276) to build a large project, which contains a number of BCB5 projects. I am aware of a variety of issues with the BCB5 command line compiler, not all of which are fixed by the “Compile C++ Builder Project” action. So I am attempting a work-around by running the IDE compiler from a batch file (IDE automation).  
  
My problem is that my batch file can successfully use commandline error codes to determine if the IDE build passes (ERRORLEVEL 0) or fails (ERRORLEVEL 1), but I would like FinalBuilder to have an “Error” status if the BCB project fails to build.  
  
I have tried setting the Min Success Code to 1 and having my batch file finish (for error) with “exit /b 0” and with “exit 0”, but it always passes.  
  
Does anybody have any clue on how I can force FinalBuilder’s “Run DOS Command” action to fail when running a batch file?  
  
Thanks,  
Rob

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [January 10, 2007, 12:51pm UTC](https://www.finalbuilder.com/forums/t/building-with-borland-c-builder5/301/2 "2007-01-10T12:51:33Z")

</div>

Hi Rob  
  
Unfortunately [command.com](http://command.com) or [cmd.com](http://cmd.com) doesn’t return the exit codes from batch files. It might be better to use the execute program action and execute the IDE directly.

---

<div class="post-metadata">

### Author: ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)
#### Post date: [January 10, 2007, 2:00am UTC](https://www.finalbuilder.com/forums/t/building-with-borland-c-builder5/301/3 "2007-01-10T02:00:37Z")

</div>

One obvious solution is to dump a file like “error.txt” in the current directory just before you terminate the batch file in error. Then check for its existence in FB after the batch file step.Actually I just tested running a batch file with the “Execute program” action, and it detected the error code fine (using “exit 5” as the last line of the batch file). Were you using that or the “Run DOS command” action? You should only use that one if you need redirection (\>, \<, |…)Steve

---

<div class="post-metadata">

### Author: ![rhunter2](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/r/bc79bd/32.png) [@rhunter2](https://www.finalbuilder.com/forums/u/rhunter2)
#### Post date: [January 10, 2007, 3:07am UTC](https://www.finalbuilder.com/forums/t/building-with-borland-c-builder5/301/4 "2007-01-10T03:07:50Z")

</div>

Thanks guys,  
  
I actually had been confused about the term “Min Success Code” in the Execute Program properties. I misunderstood it to mean anything higher than that value would pass.  
  
By exiting with “Exit 1” I get the fail that I was looking for, and “Exit 0” passes.  
  
Works great now!  
  
BTW: the BCB issues that I have encountered seem to reflect these that I found while looking for a quick fix to (1):  
  
1. Trailing backslash followed by a double-quote – gets treated like an  
escape-double-quote by MAKE  
2. Trailing backslash NOT followed by a double-quote – gets treated like a  
line-continuation character by MAKE  
3. ‘-B’ (used to set the base image address) strips relocation information  
from the executable  
  
Link to discussion on the BCB5/6 issues: [http://www.mombu.com/programming/clu/t-make-fails-with-spaces-in-target-directory-552178.html](http://www.mombu.com/programming/clu/t-make-fails-with-spaces-in-target-directory-552178.html)  
  
Thanks again,  
Rob
