Delphi 命令行编译指南

 

Delphi 命令行编译指南

目录
1. Command-line compiler
命令行编译器
2. Command-line compiler options
命令行编译器选项
3. Compiler directive options
编译器指令选项
4. Compiler mode options
编译模式选项
5. DCC32.CFG file
编译器配置文件DCC32.CFG
6. Debug options
调试选项
7. Directory options
目录选项
8. IDE command-line options
IDE命令行选项
9. Generated files
几个IDE自动生成的文件介绍

Command-line compiler
命令行编译器
Delphi's command-line compiler (dcc32.EXE) lets you invoke all the functions of the IDE compiler (DELPHI32.EXE) from the DOS command line (see IDE command-line options. Run the command-line compiler from the DOS prompt using the syntax:
Delphi’s命令行编译器(dcc32.exe)允许你从DOS命令行方式(参照:IDE命令行选项)实现IDE编译器(delphi32.exe)的所有功能。用DOS命令运行命令行编译器语法如下:
dcc32 [options] filename [options]
dcc32 [选项] [文件名] [选项]
where options are zero or more parameters that provide information to the compiler and filename is the name of the source file to compile. If you type dcc32 alone, it displays a help screen of command-line options and syntax.
零或多个参数给编译器提供信息,文件名指定需要编译的源文件名。如果你单独输入dcc32,它会显示一个关于命令行编译的选项和语法的屏幕。
If filename does not have an extension, the command-line compiler assumes .dpr, then .pas, if no .dpr is found. If the file you're compiling to doesn't have an extension, you must append a period (.) to the end of the filename.
如果文件名没有扩展名,命令行编译器会查找扩展名为.dpr的同名文件,如果找不到,则查找扩展名为.pas的同名文件。如果你的源文件确实没有扩展名,你需要在文件名的末尾添加(.)。
If the source text contained in filename is a program, the compiler creates an executable file named filename.EXE. If filename contains a library, the compiler creates a file named filename.DLL. If filename contains a package, the compiler creates a file named filename.BPL. If filename contains a unit, the compiler creates a unit file named filename.dcu.
如果指定的源文件是一个工程文件,编译器会创建一个扩展名为.EXE的同名可执行文件。如果指定的源文件是一个库文件,编译器创建一个扩展名为.DLL的同名动态链接库文件。如果指定的源文件是一个包文件,编译器会创建一个扩展名为.BPL的同名包。如果指定的源文件是一个单元文件,编译器会创建一个扩展名为.dcu的目标代码文件。
You can specify a number of options for the command-line compiler. An option consists of a slash (/) or immediately followed by an option letter. In some cases, the option letter is followed by additional information, such as a number, a symbol, or a directory name. Options can be given in any order and can come before or after the file name.
你可以为命令行编译器指定多个参数。一个参数包含一个破折号“-”(或“/”)和紧跟着的一个选项字符构成。通常情况下,选项字符后面会跟一些附加的信息,如一个数字、一个符号、一个目录等。选项可以是任意顺序并且可以在源文件名前面或后面。

Command-line compiler options
命令行编译选项
The IDE lets you set various options through the menus; the command-line compiler gives you access to these options using the slash (/) delimiter. You can also precede options with a hyphen (-) instead of a slash (/), but those options that start with a hyphen must be separated by blanks. For example, the following two command lines are equivalent and legal:
IDE允许你使用菜单来设置各种编译选项,而命令行编译器允许你使用字符“/”作为分隔符来设定这些编译选项。你也可以使用连字符“-”来代替“/”,但是用“-”引出的参数之间必须用空格隔开。例如,下面两个命令都是等同的也是合法的:
DCC -IC:/DELPHI -DDEBUG SORTNAME -$R- -$U+
DCC /IC:/DELPHI/DDEBUG SORTNAME /$R-/$U+
The first command line uses hyphens with at least one blank separating options. The second uses slashes and no separation is needed.
第一个编译命令用“-”引出参数,且参数之间有多个空格分隔。第二个编译命令用“/”引出参数,参数之间不必要分隔。
The following table lists the command-line options. In addition to the listed options, all single-letter compiler directives can be specified on the command line, as described in Compiler directive options.
下列表中列出所有的命令行参数。在附加的选项列表中,所有的单字符编译器指令都可以在命令行编译中使用,详情请参照:编译器指令。
Option  Description
选项 描述
Aunit=alias 设置单元别名
B   编译所有单元
CC  编译控制台程序
CG  编译图形界面程序
Ddefines 编译条件符号定义
Epath   可执行文件输出路径
Foffset 查找运行期间错误
GD  生成完整.Map文件
GP  生成.Map文件Public段
GS  生成.Map文件Segment段
H   输出提示信息
Ipaths  文件包含路径
J   生成.Obj目标文件
JP  生成C++类型.Obj目标文件
Kaddress Set image base address
LEpath  包.BPL文件输出路径
LNpath  .dcp文件输出路径
LUpackage  使用运行期间包列表
M   编译有改动的源文件
Npath   dcu/dpu文件输出目录
Opaths  .Obj文件(汇编目标代码文件)路径
P   按8.3格式文件名查找
Q   安静模式
Rpaths  资源文件(.RES)路径
TXext   目标文件扩展名
Upaths  单元文件路径
V   为Turbo Debugger生成调试信息文件
VN  以.Giant格式生成包含命名空间的调试信息文件(将用于C++Builder)
VR  生成调试信息文件.rsm
W   输出警告信息
Z   Disable implicit compilation
$directive Compiler directives
--Help  显示编译选项的帮助。同样的,如果你在命令行单独输入dcc32,也会显示编译选项的帮助。
--version  显示产品名称和版本

Compiler directive options
编译器指令选项
Delphi supports the compiler directives described in Compiler directives. The $ and D command-line options allow you to change the default states of most compiler directives. Using $ and D on the command line is equivalent to inserting the corresponding compiler directive at the beginning of each source file compiled.
Delphi支持用编译器指令关键字描述的编译器指令。使用“$”和“D”命令行选项可以改变所有的默认编译器状态。用“$”和“D”命令行选项等同于在源文件的前面添加编译器指令。
Switch directive option
编译器指令选项开关
The $ option lets you change the default state of all of the switch directives. The syntax of a switch directive option is $ followed by the directive letter, followed by a plus (+) or a minus (-). For example:
“$”允许你改变每一种编译器指令默认状态。编译器指令的语法是“$”后紧跟一个指令字符,再跟一个“-”或“+”。例如:
dcc32 MYSTUFF -$R-
compiles MYSTUFF.pas with range-checking turned off, while:
不使用边界检查编译MYSTUFF.pas单元:
dcc32 MYSTUFF -$R+
compiles it with range checking turned on. Note that if a {$R+} or {$R-} compiler directive appears in the source text, it overrides the -$R command-line option.
使用界面检查编译MYSTUFF.pas单元。如果将编译器指令{$R+}或{$R-}添加到源文件的开始,它将覆盖从命令行传入的参数。
You can repeat the -$ option in order to specify multiple compiler directives:
你可以用多个“$”来指定多个编译器指令,如:
dcc32 MYSTUFF -$R--$I--$V--$U+
Alternately, the command-line compiler lets you write a list of directives (except for $M), separated by commas:
命令行编译器允许作用逗号分隔的编译器指定列表,如:
dcc32 MYSTUFF -$R-,I-,V-,U+
只需要用一个“$”符号。
Only one dollar sign ($) is needed.
注意,因为$M的格式不一样,你不能在逗号分隔的指令列表中使用$M
Note that, because of its format, you cannot use the $M directive in a list of directives separated by commas.
Conditional defines option
条件编译选项
The -D option lets you define conditional symbols, corresponding to the {$DEFINE symbol} compiler directive. The -D option must be followed by one or more conditional symbols separated by semicolons (;). For example, the following command line:
“-D”选项允许你定义一个编译条件,符合你用{$DEFINE symbol}定义的编译器指令。“-D”选项后必须跟随一或多个用分号分隔的编译条件符号,如下命令:
dcc32 MYSTUFF -DIOCHECK;DEBUG;LIST
defines three conditional symbols, iocheck, debug, and list, for the compilation of MYSTUFF.pas. This is equivalent to inserting:
定义了三个编译条件符号:IOCHECK,DEBUG,LIST,用于MYSTUFF.pas单元中。这等同于在源文件中插入以下语句:
{$DEFINE IOCHECK}
{$DEFINE DEBUG}
{$DEFINE LIST}
at the beginning of MYSTUFF.pas. If you specify multiple -D directives, you can concatenate the symbol lists. Therefore:
如果你指定了多个“-D”选项,你可以联接它们,如下:
dcc32 MYSTUFF -DIOCHECK-DDEBUG-DLIST

is equivalent to the first example.
等同于第一个例子。

Compiler mode options
编译模式选项
A few options affect how the compiler itself functions. As with the other options, you can use these with either the hyphen or the slash format. Remember to separate the options with at least one blank.
有几个选项能影响编译器自身的功能。像其它选项一个,你可以使用“/”或“-”的格式。别忘了用至少一个空格分隔这些选项。
Make (-M) option
选项(-M)
The command-line compiler has built-in MAKE logic to aid in project maintenance. The -M option instructs command-line compiler to check all units upon which the file being compiled depends. Using this option results in a much quicker compile time.
命令行编译器使用构造逻辑的方式来维护工程。“-M”选项指示编译器检查所有与编译文件相关联的文件。用这个参数会导致编译时间增大。 
A unit is recompiled under the following conditions:
一个源文件在下列情况下会重新编译:
The source file for that unit has been modified since the unit file was created.
源文件被创建以来被修改过;
用“$I”指令包含的任何文件,用“$L”包含的任何.Obj文件,或用“$R”关联的任何资源文件.Res,比源文件中的要新;
Any file included with the $I directive, any .OBJ file linked in by the $L directive, or any .res file referenced by the $R directive, is newer than the unit file.
The interface section of a unit referenced in a uses statement has changed.
单元接口部分interface的uses段有改动。
Units compiled with the -Z option are excluded from the make logic.
在单元编译时指令“-Z”在构造逻辑期不被接受。
If you were applying this option to the previous example, the command would be:
如果你在上一个例子中使用这个指令,编译命令就应该是:
dcc32 MYSTUFF -M
Build all (-B) option
编译所有 选项(-B)
Instead of relying on the -M option to determine what needs to be updated, you can tell command-line compiler to update all units upon which your program depends using the -B option. You can't use -M and -B at the same time. The -B option is slower than the -M option and is usually unnecessary.
用于取代要知道哪些单元需要更新-M的选项,你可以使用-B选项来更新所有你的程序中关联的单元。你不能在程序中同时使用-M和-B。选项-B比-M速度更慢,而且它并不是必需的。
If you were using this option in the previous example, the command would be
如果你在前一个例子中使用这个参数,编译命令就应该是:
dcc32 MYSTUFF -B
Find error (-F) option
查找错误 选项(-F)
When a program terminates due to a runtime error, it displays an error code and the address at which the error occurred. By specifying that address in a -Faddress option, you can locate the statement in the source text that caused the error, provided your program and units were compiled with debug information enabled (via the $D compiler directive).
当一个程序由于运行期间错误而终止时,它会显示一个错误号和错误地址在错误发生时。用-Faddress选项来指定错误地址,你在源文件中能找到引发错误的位置,如果你的程序和单元编译时附加了调试信息(使用$D编译器指令)。
In order for the command-line compiler to find the runtime error with -F, you must compile the program with all the same command-line parameters you used the first time you compiled it.
为了命令行编译器能用-F选项查找运行期间错误,你必须传递与第一次编译时相同的指令列表。
As mentioned previously, you must compile your program and units with debug information enabled for the command-line compiler to be able to find runtime errors. By default, all programs and units are compiled with debug information enabled, but if you turn it off, using a {$D-} compiler directive or a -$D- option, the command-line compiler will not be able to locate runtime errors.
先前提到过,你的程序和单元必须启用调试信息,命令行编译器才能查找运行期间错误。默认情况下,所有的程序和单都是启用调试信息的,除非你用{-D}或-$D-指令关闭它,这样,命令行编译器就不能查找运行期间错误了。
Use packages (-LU) option
使用包(-LU)选项
Use the -LU option to list additional runtime packages that you want to use in the application being compiled. Runtime packages already listed in the Project Options dialog box need not be repeated on the command line.
使用-LU选项来在编译时添加你应用程序中要用到的运行期间包。运行期间包已经在“工程选项”对话框中列举的,不必再在命令行中添加。
Disable implicit compilation (-Z) option
(此选项在delphi6.0/7.0中有不同描述,在此不作翻译)
The -Z option prevents packages and units from being implicitly recompiled later. With packages, it is equivalent to placing {$ IMPLICITBUILD OFF} in the .dpk file. Use -Z when compiling packages that provide low-level functionality, that change infrequently between builds, or whose source code will not be distributed.
Target file extension (-TX) option
目标文件扩展名(-TX)选项
The -TX option lets you override the default extension for the output file. For example,
选项-TX允许你改写默认的输出文件扩展名。例如:
dcc32 MYSTUFF -TXSYS 
generates compiled output in a file called MYSTUFF.SYS.
生成的将是一个叫做MYSTUFF.SYS的文件。
Quiet (-Q) option
安静模式(-Q)选项
The quiet mode option suppresses the printing of file names and line numbers during compilation. When the command-line compiler is invoked with the quiet mode option
安静模式选项禁止在编译时显示文件名及代码行数,如果命令行编译器调用这个选项的话。
dcc32 MYSTUFF -Q its output is limited to the startup copyright message and the usual statistics at the end of compilation. If any errors occur, they will be reported.

它的输出仅限于起始时行版权信息以及结尾的统计信息。当然,如果发生错误,它也会输出。

DCC32.CFG file
DCC32.CFG配置文件
You can set up a list of options in a configuration file called DCC32.CFG, which will then be used in addition to the options entered on the command line. Each line in configuration file corresponds to an extra command-line argument inserted before the actual command-line arguments. Thus, by creating a configuration file, you can change the default setting of any command-line option.
你可以设置一个编译选项列表到一个叫做DCC32.CFG的配置文件中,它将用于编译时附加到命令行参数后。配置文件的每一行都相当于一个额外的命令行参数插入到实际的命令行参数前(注意,是实际参数前)。因而,你可以使用这个配置文件改变一些命令行参数的默认设置。
The command-line compiler lets you enter the same command-line option several times, ignoring all but the last occurrence. This way, even though you've changed some settings with a configuration file, you can still override them on the command line.
命令行编译器允许你输入相同的命令行参数,它将忽略所有除最后一个之外。这个的话,尽管通过配置文件你可以改变一些设置,你仍然可以覆盖它使用命令行参数。
When dcc32 starts, it looks for DCC32.CFG in the current directory. If the file isn't found there, dcc32 looks in the directory where DCC32.EXE resides.
当dcc32启动时,它查找DCC32.CFG文件在当前目录。如果文件没有找到,dcc32会查找它所在的目录。
Here's an example DCC32.CFG file, defining some default directories for include, object, and unit files, and changing the default states of the $O and $R compiler directives:
以下是一个DCC32.CFG配置文件的例子,定义了关于文件包含、OBJ文件包含、单元文件搜索路径信息,并改变了编译器指令$O和$R的默认值。
-IC:/DELPHI/INC;C:/DELPHI/SRC
-OC:/DELPHI/ASM
-UC:/DELPHI/UNITS
-$R+
-$O-
Now, if you type:
现在,如果你输入:
dcc32 MYSTUFF 
the compiler performs as if you had typed the following:
编译器把它当作你输入如下命令:
dcc32 -IC:/DELPHI/INC;C:/DELPHI/SRC -OC:/DELPHI/ASM -UC:/DELPHI/UNITS -$R+ -$O- MYSTUFF

Debug options
调试选项
The compiler has two sets of command-line options that enable you to generate external debugging information: the map file options and the debug info options.
编译器有两个命令行参数可以生成外部调试信息:MAP文件选项和调试信息选项。
Map file (-G) options
Map文件(-G)选项
The -G option instructs the command-line compiler to generate a .map file that shows the layout of the executable file. Unlike the binary format of executable and .dcu files, a .map file is a legible text file that can be output on a printer or loaded into the editor. The -G option must be followed by the letter S, P, or D to indicate the desired level of information in the .map file. A .MAP file is divided into three sections:
选项-G指示命令行编译器生成一个.map文件来查看一个可执行文件的布局。不同于可二进制的可执行文件和.dcu文件,.map文件是一个可读的文本文件,可以被打印或是其它文本编辑器编辑。选项-G后必须跟字符S、P或D,去决定你想要在.map文件列出的信息。一个.MAP文件被分成三个节:
Segment
Publics
Line Numbers
-GS outputs only the Segment section, -GP outputs the Segment and Publics section, and -GD outputs all three sections. -GD also generates a .DRC file that contains tables of all string constants declared using the resourcestring keyword.
-GS选项只输出Segment Section,-GS选项输出Segment和Publics,-GD输出所有的三个Sections.-GD选项也生成一个扩展名为.DRC的文件包含所有的用resourcestring关键字声明的字符串常量。
For modules (program and units) compiled in the {$D+,L+} state (the default), the Publics section shows all global variables, procedures, and functions, and the Line Numbers section shows line numbers for all procedures and functions in the module. In the {$D+,L-} state, only symbols defined in a unit's interface part are listed in the Publics section. For modules compiled in the {$D-} state, there are no entries in the Line Numbers section.
用默认的编译选项{$D+,L+}编译模块(程序或单元),Publics Section列举所有的全局变量、过程和函数,Line Numbers Section列举模块中所有的过程和函数的行号。如果用{$D+,L-}编译选项编译模块,Publics Section中仅列举在单元的interface部分定义的符号。如果用{$D-}选项编译模块,在Line Numbers Section没有任何入口。
Debug info (-V) options
调度选项(-V)
The -V options (-V, -VN. and -VR), which cause the compiler to generate debug information, can be combined on the command line.
选项-V、-VN、-VR会指示编译器生成调试信息,它们能在命令行中组合使用。
Generate Turbo Debugger debug info (-V) option
生成Turbo Debugger使用的调试信息的选项(-V)
When you specify the -V option on the command line, the compiler appends Turbo Debugger 5.0-compatible external debug information at the end of the executable file. Turbo Debugger includes both source- and machine-level debugging and powerful breakpoints.
当你在命令行中使用-V选项时,编译器会在可执行文件的末尾附加与Turbo Debugger5.0一致的外部调试信息。Turbo Debugger包含代码和硬件级别的强大的断点。 
Even though the debug information generated by -V makes the resulting executable file larger, it does not affect the actual code in the executable, and does not require additional memory to run the program.
虽然附加调试信息到查执行文件中会使可执行文件增大,但是它并不影响实际可执行文件中的可执行代码,也不需要额外的内存来启动程序。
The extent of debug information appended to the executable file depends on the setting of the $D and $L compiler directives in each of the modules (program and units) that make up the application. For modules compiled in the {$D+,L+} state, which is the default, all constant, variable, type, procedure, and function symbols are known to the debugger. In the {$D+,L-} state, only symbols defined in a unit's interface section are known to the debugger. In the {$D-} state, no line-number records are generated, so the debugger cannot display source lines when you debug the application.
附加到可执行文件上的调试信息的大小取决于编译这个应用程序要用到的第一个单元中的$D和$L编译器指令。使用编译器默认的选项{$D+,$L+}来编译模块,所有的常量、变量、类型、过程和函数的符号都会传递给调试器。使用选项{$D+,L-}编译,仅有在单元interface部分列出的符号才会传递给调试器。使用选项{$D-}编译,调试信息中没有生成行号信息,所以,调试程序时调试器不能显示源代码中的行。
The IDE internal debugger does not use Turbo Debugger debug information. Because generating Turbo Debugger debug information almost doubles compile/link time, you should turn off Turbo Debugger debug information generation except when you're debugging the application in Turbo Debugger.
IDE内置的调试器不使用Turbo Debugger调试信息。因为生成Turbo Debugger调试信息几乎会成倍的增加编译或链接的时间,你可以关闭生成Turbo Debugger调试信息,除非你在Turbo Debugger中调试你的应用程序。
Generate namespace debug info (-VN) option
生成命名空间调试信息选项(-VN)
When you specify the -VN option on the command line, the compiler generates namespace debugging information in the Giant format used by C++Builder. This allows the C++ compiler to find Pascal symbols. Use this switch when you are compiling code that will be used by C++Builder.
当你在命令行中使用-VN选项时,编译器会生成C++Builder中使用的Giant格式的命名空间调试信息。它让C++编译器能使用Pascal的符号。如果你的代码被用于C++Builder时你可以用这个选项。
Generate debug symbol info (-VR) option
生成调试符号信息选项(-VR)
When you specify the -VR option on the command line, the compiler generates debugging symbol information in an .rsm file.

当你在命令行中使用-VR选项时,调试器会生成一个含有调试符号信息的.rsm文件。

Directory options
目录选项

Several options allow you to specify the directory lists used by the command-line compiler: include (-I), dcu input (unit search path, -U), resource (-R), object (-O), executable and dcu output (-E), and dcu output (-N).
 一些选项允许你指定命令行编译器使用的目录列表:包含选项(-I),dcu查找目录选项(-U),资源文件目录选项(-R),二进制对象目录选项(-O),可执行文件和dcu文件输出目录选项(-E),dcu文件 输出目录选项(-N)。
You can specify multiple directories, separated by semicolons, for some options. For example, this command line tells the command-line compiler to search for include files in C:/DELPHI/INCLUDE and D:/INC after searching the current directory:
一些选项中,你可以使用用”;”分隔的多个目录。例如,以下这个命令告诉命令行编译器,如果在当前目录中没有找到,再到” C:/DELPHI/INCLUDE”和”D:/INC”目录中搜索包含的文件:
dcc32 MYSTUFF -IC:/DELPHI/INCLUDE;D:/INC
If you specify multiple directives, the directory lists are concatenated. Therefore,
如果你使用了指定目录的多个指令,这些目录会被联接起来,因此:
dcc32 MYSTUFF -IC:/DELPHI/INCLUDE -ID:/INC
is equivalent to the first example.
它等同于第一个例子。
Executable directory (-E) option
可执行文件目录选项(-E)
This option lets you tell the command-line compiler where to put the .EXE file it creates. It takes a directory path as its argument:
这个选项指示命令行编译器把生成的可执行文件输出到哪个目录。它取一个目录作为它的参数:
dcc32 MYSTUFF -EC:/DELPHI/BIN
dcc MYSTUFF -E/home/kylix/bin
You can specify only one executable directory, which is also used for .DLL files. The -E option does not affect the location of .BPL (package) files.
你只能指定一个可执行文件路径,它同时也会被用于输出动态链接库(.DLL)的输出。-E选项对输出包文件(.BPL)没有影响。
If no such option is given, the command-line compiler creates .EXE files in the same directories as their corresponding source files.
如果没有这个选项,编译器会把生成的可执行文件放在相应的源文件的相同目录里。
Package directory (-LE) option
包文件输出目录选项(-LE)
This option lets you tell the command-line compiler where to put the file it creates when it compiles a package. The syntax is the same as -E.
这个选项指示编译器把生成的包文件(.BPL)输出到哪个目录。它的语法同(-E)。
Package symbol info directory (-LN) option
包符号信息文件输出目录选项(-LN)
This option lets you tell the command-line compiler where to put the .dcp (package symbol info) file it creates when it compiles a package. The syntax is the same as -E.
用这个选项你可以指示编译器在编译一个包时把生成的包符号信息文件.dcp输出到哪个目录。它的语法同(-E)。
Compiled unit directory (-N) option
单元目标文件.dcu输出目录选项(-N)
This option lets you tell the command-line compiler where to put the .dcu (compiled unit) files it creates when it compiles a unit. The syntax is the same as -E.
用这个选项你可以指示编译器在编译一个单元文件时把生成的.dcu文件输出到哪个目录。它的语法同(-E)。
Include directories (-I) option
文件包含目录选项(-I)
Delphi supports include files through the {$I filename} compiler directive. The -I option lets you specify a list of directories in which to search for include files.
Delphi支持使用编译器指令{$filename}来指定文件包含目录。-I选项允许你指定一个目录列表来搜索文件包含目录。
Unit directories (-U) option
单元文件搜索目录选项(-U)
When you compile a program that uses units, the command-line compiler searches for source and compiled unit files in the current directory. The -U option lets you specify additional directories in which to search for units.
当你编译的程序使用了其它单元文件。编译器会在本目录搜索源文件和已编译单元。-U选项允许你指定其它的目录来搜索源文件和已编译单元。
Resource directories (-R) option
资源文件目录选项(-R)
The compiler searches for resource files in the current directory. The -R option lets you indicate additional directories where dcc32 should look for resource files.
编译器会在当前目录搜索资源文件。-R选项允许你指示编译器在其它指定的目录搜索资源文件。
Object files directories (-O) option
对象文件目录选项(-O)
Using {$L filename} compiler directives, you can link .OBJ files containing machine code created by external assemblers or other compilers, such as Borland C++. The -O option lets you specify a list of directories in which to search for such .OBJ files.
使用用编译器指令{$L 文件名},可以在你的程序中链接其它外部汇编程序或编译器生成的目标代码文件(.OBJ文件),比如Borland C++.-O选项允许你指定一个编译器搜索.OBJ文件的目录列表。

IDE command-line options
IDE命令行选项

This topic lists and describes all of the options that you can use to start the IDE from the command line.
这个主题列举和描述了你用命令行启动IDE所能使用的所有的选项。
You must precede all options (unless otherwise noted) with either a dash (-) or a slash (/). The options are not case sensitive.Therefore, the following options are all identical: -d /d -D /D. 
你必须在每一个选项前面添加”-“或”/”,除非有其它的说明。选项是不区分大小写的,因此,以下两组命令是相同的:-d /d -D /D。
You use these options with the IDE startup command: delphi32.exe. 
你可以在IDE启动命令:delphi32.exe后使用这些选项。
For example:
例如:
delphi32.exe -ns -hm
Starts the IDE with no splash screen and tracks memory allocation.
它启动IDE时不显示闪屏并在IDE的标题栏中动态的显示内存的分配情况。
delphi32.exe -s dc:/test/source -d c:/test/myprog.exe -td
Starts the IDE and loads c:/test/myprog.exe into the debugger and used c:/test/source as the location for the source code while debugging. The -td and any other argument that appears after the -dexename debugger option is used as an argument to c:/test/myprog.exe.
启动IDE同时将c:/test/myprog.exe载入调试器,使用c:/test/source作为调试器搜索源代码的目录。-td和-dexename后面的调试器参数都像c:/test/myprog.exe这个参数一样使用。
General options
一般选项
Option Description
选项 描述
? Displays help for IDE command-line options. 
显示IDE的命令行选项的帮助信息。
hm Heap Monitor. Displays information in the IDE title bar regarding the amount of memory allocated using the memory manager. Displays the number of blocks and bytes allocated. Information gets updated when the IDE is idle. 
堆显示器。在IDE的标题栏上显示内存管理器关于内存分配方面的信息。显示分配的内存块和字节数。在IDE空闲时信息会更新。
hv Heap Verify. Performs validation of memory allocated using the memory manager. Displays error information in the IDE title bar if errors are found in the heap. 
堆校验。显示内存管理器关于确认内存分配的信息。如果堆出错,就会在IDE标题栏中显示相关信息。
ns No splash screen. Suppresses display of the splash screen during IDE startup. 
不显示闪屏。在IDE启动时禁止显示闪屏。
np No Project. Supresses loading of any desktop files on IDE startup and suppresses creation of a default project. 
不载入工程。在IDE启动时禁止载入任何桌面配置文件也不加载默认工程。
Debugger options
调试器选项
Option Description
选项 描述
dexename Loads the specified executable (exename) into the debugger. Any parameters specified after the exename are used as parameters to the program being debugged and are ignored by the IDE. A space is allowed between the d and the exename.
在调试器中载入指定的可执行文件(由exename指定)。在exename后用于这个程序的参数在调试时会被IDE忽略。允许在d和exename之间添加一个空格。
attach:%1;%2 Performs a debug attach, using %1 as the process ID to attach to and %2 as the event ID for that process. It can be used manually, but is used mostly for Just in Time debugging. 

td TDGoodies. Implements several features found in the TurboDebugger, TD32. It must be used with the d option. It causes the CPU and FPU views to stay open when a process terminates. It causes Run|Program Reset to terminate the current process and reload it in the debugger. If there is no current process, Run|Program Reset reloads the last process that terminated. It also causes breakpoints and watches to be saved in the default desktop if desktop saving is on and no project is loaded. 

sddirectories Source Directories. Must be used with the d option. The argument is either a single directory or a semicolon delimited list of directories which are used as the Debug Source Path setting (can also be set using the Project|Options|Directories/Conditionals option page). No space is allowed between sd and the directory list argument. 
源代码目录。必须和d选项一起使用。这个参数可以是一个单独的目录,也可以是一个用分号作分隔符的目录列表,它被用于调试器的源代码目录设置(这个设置也可以在IDE的”Project->Options->Directories->Conditional”选项卡)。在sd和目录列表之间不允许有空格。
hhostname Hostname. Must be used with the d option. When specified, a remote debug session is initiated using the specified host name as the remote host to debug on. The remote debug server program must be running on the remote host. 
主机名。必须和d选项一起使用。当指定这个参数时,一个远程调试Session使用这个指定的主机名作为远程主机被初始化。远程调试服务器必须已经运行。
Project options
工程选项
Option Description
选项 描述
filename (No preceding dash) The specified filename is loaded in the IDE. It can be a project, project group, or a single file. 
(如果当前没有打开任何文件)这个指定的文件被载入到IDE中。这可以是一个工程,一个工程组或者单个文件。
b AutoBuild. Must be used with the filename option. When specified, the project or project group is built automatically when the IDE starts. Any hints, errors, or warnings are then saved to a file. Then the IDE exits. This facilitates doing builds in batch mode from a batch file. The Error Level is set to 0 for successful builds and 1 for failed builds. By default, the output file has the same name as the filename specified with the file extension changed to .err. This can be overridden using the o option. 
自动编译。必须和filename选项同时使用。当指定这个参数,这个工程或工程组在IDE启动时会自动编译。所有的提示、错误或警告都会被存入一个文件,然后IDE会退出。这可以用于批处理文件中成批编译工程。在编译成功时错误级别会被置0,否则如果编译失败错误级别会被置1。默认情况下,输出文件使用和filename相同的文件名,扩展名为.err。它可以被覆盖,如果使用o选项。
m AutoMake. Same as AutoBuild, but a make is performed rather than a full build.
自动Make。和AutoBuild一样,只不过,它相当于整体编译(full build).
ooutputfile Output file. Must be used the b or m option. When specified, any hints, warnings, or errors are written to the file specified instead of the default file.
输出文件名。必须和b或者m选项一起使用。当指定这个参数时,任何提示,警告或者错误都会被写入这个指定的文件取代默认文件名。

Generated files
几个IDE自动产生的文件介绍
Delphi generates other files in conjunction with maintaining and compiling your project, most of which you never need to consider. However, you should not delete these files. These include the following:
Delphi在维护和编译你的程序时会相关联的生成一些其它文件,绝大多数据情况下,你并不需要理会它们。然而,你不能删除这些文件。这些文件都包括:
File or Extension Description
文件或扩展名 描述
cfg Project configuration file. Stores project configuration settings. It has the same name as the project file, but with the extension .cfg.
工程配置文件。保存工程配置选项。它和工程名同名,但是扩展名为.cfg。
The compiler searches for a dcc32.cfg in the compiler executable directory, then for dcc32.cfg in thecurrent directory, and then finally for projectname.cfg in the project directory. You can therefore type:
编译器会在编译器可执行文件的目录搜索dcc32.cfg,然后在当前目录,最后在projectname.cfg的目录中搜索。你可以如下输入:
dcc32 project1 

on the command line and compile the project with all the same options as specified in the IDE. You can also type:
在命令行编译工程也使用和IDE里指定的一样的选项。你可以如下输入:
make -f projectgroup1.bpg 

to make all the targets in the project group.
Make所有的工程在指定的工程组中。
dci Holds Code Insight changes you make in the IDE.
保存你在IDE中改动的代码。
dct Holds component template changes you make in the IDE. 
保存你在IDE中使用的组件模板。
dmt Holds changes you make to menu templates in the IDE (may cause a "Stream Read Error" if corrupt; deleting it will lose your changes to menu templates but resolve the error).
保存你在IDE中使用的菜单模板(如果损坏,会引发”Stream Read Error”错误;如果你删除它,会丢失你的修改,但是可以解决错误的问题)。
dof Delphi options file. Contains the current settings for project options, such as compiler and linker settings, directories, conditional directives, and command-line parameters. Set these options using the Project Options dialog box (Project|Options), they are saved in text form for easy maintenance, version control, and sharing.
Delphi选项文件。包含当前的工程选项,如编译和联接选项、目录选项、条件选项还有命令行参数等选项。使用工程选项对话框来设定这些选项(Project->Options),这些选项使用文本格式存储,用于简单维护、版本控制和共享。
dro Holds changes when items are added to the repository. Can be deleted but your additions to the repository will lost. Can be restored to default by copying the original file ../bin/delphi32.dro from the product CD.
保存你加入知识库的更改。可以被删除,但是你加入知识库的细节会丢失。如果你从CD中拷贝原始的文件:../bin/delphi32.dro,可以把它恢复默认值。
dsk Desktop settings. Saves the current state of the desktop, such as which windows are open, and in what positions. Used when Tools|Environment Options|Preferences Autosave Desktop is checked. Depending on where you?re working, you?ll save desktop settings for the project (Project.dsk), project group (Group.dsk), or IDE (.dsk). Delete these if you do not want to save the desktop settings.
桌面设置。保存当前的桌面状态,如哪个窗口被打开,这个窗口在屏幕的位置等。当Tools->Environment Options->Preferences->AutoSave Desktop选项被选中时桌面状态会自动保存。取决于你在哪儿工作,你可以为工程(Project.dsk),工程组(Group.dsk)和IDE(.dsk)保存桌面设置。如果你不想保存桌面设置,你可以删除它们。
res Contains the version info resource (if required) and the application?s main icon. This file may also contain other resources used within the application but these are preserved as is. Do not delete this file if your application contains any references to it.
保存与版本相关的资源(如果需要的话)和主窗体的标题栏图标。这个文件也可以包含其它的在工程中使用的资源,但是它们是受保护的。不要删除这个文件,如果你的工程涉及到任何与它的关联。
tds Holds the external debug symbol table.
保存外部的调试符号表。

todo To-do list file. Includes the current to-do list for the project. It has the same name as the project file, but with the extension .TODO.
To-do列表文件。保存当前工程的To-do列表。它有和工程名相同的名称,但是扩展名为.TODO。

 

时间: 2024-09-28 08:28:47

Delphi 命令行编译指南的相关文章

用命令行编译java并生成可执行的jar包

用命令行编译java并生成可执行的jar包 1.编写源代码. 编写源文件:CardLayoutDemo.java并保存,例如:I:\myApp\CardLayoutDemo.java.程序结构如下: package test; import java.awt.*; import javax.swing.*; //更多包的导入... class NotePadFrame extends JFrame { //主界面的设计... } //其他相关代码... public class CardLayo

ide-c程序用cmd命令行编译链接的exe跟在IDE中生成的一样么?

问题描述 c程序用cmd命令行编译链接的exe跟在IDE中生成的一样么? 就是用cl命令生成的exe,和visual c++6.0的对比,是否一样,如果不一样怎么让他们一样? 解决方案 主要是一些编译选项,你cl命令行需要自己跟VC所配置的编译选项一致. 解决方案二: 你可以写一个小程序: void main(int argc, char ** args) { for (int i = 0; i < argc; i++) cout << args[i] << endl; sy

基于命令行编译打包phonegap for android应用

也许你习惯了使用Eclipse编译和打包Android应用.不过,对于使用html5+js开发的phonegap应用,本文建议你抛弃Eclipse,改为使用命令行模式,绝对的快速和方便. 一直以来,Eclipse+ADT是广大Android应用开发者的必备工具,毋庸置疑,Ecplise在开发Android原生应用方面有着几乎不可替换的位置.Phonegap是一个已经不算是新鲜事物的东西了.PhoneGap是一个开源的开发框架,使用HTML,CSS和JavaScript来构建跨平台的的移动应用程序

java-ofbiz在命令行编译时unable to access jarfile *.jar

问题描述 ofbiz在命令行编译时unable to access jarfile *.jar 2.1 命令行原始方式编译 进入ofbiz根目录之后执行java -jar framework/base/lib/ant-launcher-1.7.1.jar -lib framework/base/lib/ant(需要设置path环境变量) 2.2 命令行批处理方式编译 进入ofbiz 根目录之后window环境执行ant或者ant.batlinux环境执行./ant .(需要设置JAVA_HOME

msvc交叉编译:使用vcvarsall.bat设置命令行编译环境

一直以来我只知道vc设置命令行编译环境的批处理命令是%VS140COMNTOOLS%/Common7/Tools下的vsvars32.bat,(%VS140COMNTOOLS%为定义vs2015公共工具程序位置的环境变量,命令行窗口输入set就能找到,vs2010的对应定义为%VS100COMNTOOLS%) 微软的官网上有这个命令的说明: https://technet.microsoft.com/zh-cn/library/1700bbwd.aspx 但在执行这个命令生成的命令行环境下用nm

mac-Mac Pro 怎么用命令行编译x-code文件

问题描述 Mac Pro 怎么用命令行编译x-code文件 您好,Mac Pro 怎么用命令行编译x-code文件.是不是要绑定什么文件呢,谢谢啦,大神. 解决方案 mac通过命令行搜索文件 解决方案二: clang: warning: -framework Foundation: 'linker' input unused 这就是提示

关于visual studio 2015中c#的命令行编译问题

问题描述 你们好,是这样的,我想用visualstudio2015的命令提示窗口把.cs文件编译成.exe文件我的程序是这样的usingSystem;classexample_2{staticvoidMain(){Console.WriteLine("很高兴学习c#语言");}}但命令行编译不了,输出:MicrosoftWindows[版本10.0.10586](c)2015MicrosoftCorporation.保留所有权利.E:网页设计>cscexample_2.cs'cs

命令行编译Qt程序(nmake)

简述 前两节讲解了如何在Visual Studio和Qt Creator中搭建Qt开发环境,并分享了我们第一个小程序-Hello World. 下面分享如何使用命令行来编译Qt程序.当然,MSVC和MinGW的配置和编译过程相差无几. 简述 编译Qt程序 注意事项 编译Qt程序 1.新建一个"HelloWorld.cpp"文件,编写代码: #include <QApplication> #include <QLabel> int main(int argc,ch

Qt之命令行编译(nmake)

简述 前两节讲解了如何在Visual Studio和Qt Creator中搭建Qt开发环境,并分享了我们第一个小程序-Hello World. 下面分享如何使用命令行来编译Qt程序.当然,MSVC和MinGW的配置和编译过程相差无几. 简述 新建 打开命令行 生成 pro qmake nmake 运行 注意事项 新建 新建一个"HelloWorld.cpp"文件,编写代码: #include <QApplication> #include <QLabel> in