IDE command-line options
by Kent Reisdorph
The C++Builder IDE has a number of command-line options that can be used to control how the IDE starts. For the most part, these command-line options are undocumented (they are documented in C++Builder 5 but not in earlier versions). You can use the C++Builder IDE much more effectively by better understanding the IDE’s command-line options.
Using the command-line options
Not all of the command-line options described here are available on every version of C++Builder. As far as I know, only C++Builder 5 documents these options. To view the help page that describes the command-line options for C++Builder 5, see the topic “command-line options, IDE (BCB.EXE)” in the help file. Alternatively you can start C++Builder 5 with the -? option. When C++Builder 5 is started with this option, the help page describing the command-line options will be displayed.
The command-line options can be specified using either a forward slash or a dash. If, for example, you wanted to start the IDE with the ns option (explained in the next section) you would use either of these commands:
The command-line options are not case sensitive so ns and NS result in the same behavior.
The easiest way to implement the command-line options is to simply add them to the shortcut for the IDE (the IDE executable is BCB.EXE and is in your BIN directory).
The following sections explain the command-line options, broken down into relevant categories.
The startup options are ns and np. The ns option (which is short for “no splash”) suppresses the splash screen that is displayed when C++Builder is loading. On some systems, bad video drivers can cause the IDE to generate an error when the IDE starts up or, in some cases, shuts down. By inhibiting the splash screen, these errors are usually eliminated.
The np option (“no project”) is only available in C++Builder 5. This option starts the IDE but does not create a default blank project. This is particularly useful for those users who dislike the initial blank project that is displayed by default. I don’t mind the blank default project, but I know that many C++Builder users have complained about it. Now those users have a way of eliminating the blank project on startup (C++Builder 5 users anyway).
The heap command-line options are hm and hv. The hm option (“heap monitor”) causes the IDE to display heap statistics in the IDE’s title bar. Figure A shows the C++Builder 5 IDE’s title bar when the IDE is started with this option. I suspect that this option is used primarily as an IDE debugging tool for the Borland developers. However, it is sometimes interesting to watch the IDE’s memory usage during a build. It can also be used if you notice odd IDE behavior and wish to report that behavior to Borland.
The hm option displays IDE heap usage in the title bar.
The hv (“heap verification”) option is used to track memory errors that occur in the IDE. If any heap errors are detected, they are report in the IDE’s title bar.
Project options are used to load a specific project when the IDE loads; to build or make a project when the IDE loads; and to specify an output file for compiler errors or warnings.
To specify the project that should be loaded when the IDE starts, simply add the project name to the command line:
This allows you to have several shortcuts to C++Builder, each specifying its own project. The command-line option is available in all versions of C++Builder.
The b option (“build”) tells the IDE to build the specified project when the IDE loads. For example:
bcb.exe c:\myfiles\myproject.bpr -b
When the b option is used, the IDE will start; load the specified project; build it; and then close.
The m option (“make”) works just like the b option but makes the project rather than building it.
The o option (“output”) allows you to specify an output file for compiler errors and warnings. This option must be used with either the m or b options. The resulting error file will be placed in the project directory.
The m, b, and o options are only available in C++Builder 5.
The debugger command-line options are more for power users. As such, I’ll only give them light treatment here.
The d option (“debug”) is used to open the IDE and debug an existing project. Obviously, the project must have been built using debug information (the default for new projects). Simply specify the EXE name following the d option:
When this command executes, the IDE will load; load the specified executable; and start the debugger. The debugger will pause in the application’s startup code (in WinMain() for a GUI application). This option is available on C++Builder 4 and 5.
The attach option allows you to attach a running process to the debugger. It is the same as choosing Debug | Attach to Process from the IDE’s main menu.
The td option (“TurboDebugger”) is used with the d option. It controls how the IDE behaves when the debugger runs. For one thing, it causes the CPU and FPU windows to stay open when the process terminates.
The sd option (“source directories”) allows you to specify the directories where the source code is loaded. It is used with the d option.
The h option (“hostname”) is used to specify the remote host name of a remote machine when performing remote debugging. It is used with the d option.
The l option (a lowercase L) tells the debugger to start debugging but to skip the startup code. I’m not sure how useful this is, as the debugger stops with the CPU window initially displayed.
Most programmers will never use the bulk of the command-line options available in C++Builder. However, the np and ns options alone can be invaluable. Knowing exactly what your tools are capable of is part of the key to success.