天天看點

Delphi 指令行編譯指南

<a target="_blank" href="http://www.cnblogs.com/del/articles/1067412.html">Delphi 指令行編譯指南</a>

目錄

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

它等同于第一個例子。

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

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

調試器選項

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-&gt;Options-&gt;Directories-&gt;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

工程選項

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-&gt;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-&gt;Environment Options-&gt;Preferences-&gt;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。

繼續閱讀