ImageVerifierCode 换一换
格式:DOC , 页数:16 ,大小:87.50KB ,
资源ID:2968853      下载积分:20 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-2968853.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(Delphi命令行编译指南.doc)为本站会员(dzzj200808)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

Delphi命令行编译指南.doc

1、Delphi 命令行编译指南 Borland 出品的 Delphi,有着闪电般的编译速度,但是在界面控件使用较多、工程项目较大的时候,编译一个工程仍需要一段时间,打开庞大的 Delphi IDE,也需要时间。其实,在一个工程开发结束,调试完成之后的 Release 编译,完全可以用命令行来执行,因为 Delphi 的编译器参数不像 C+编译器那样复杂。笔者把 Delphi 联机手册中关于命令行编译(command-line compiler)的几篇主题作了翻译,希望对 Delphi 开发人员有帮助。目录1 Command-line compiler 命令行编译器2 Command-line c

2、ompiler 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 自动产生的文件介绍1 Command-line compiler 命令行编译器Delphis command-line compiler (dcc32

3、.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:Delphis 命令行编译器 (dcc32.exe)允许你从 DOS 命令行方式 (参照:IDE 命令行选项)实现 IDE 编译器(delphi32.exe)的所有功能。用 DOS 命令运行命令行编译器

4、语法如下:dcc32 options filename optionsdcc32 选项 文件名 选项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.零或多个参数给编译器提供信息,文件名指定需要编译的

5、源文件名。如果你单独输入dcc32,它会显示一个关于命令行编译的选项和语法的屏幕。If filename does not have an extension, the command-line compiler assumes .dpr, then .pas, if no .dpr is found. If the file youre compiling to doesnt have an extension, you must append a period (.) to the end of the filename.如果文件名没有扩展名,命令行编译器会查找扩展名为.dpr 的同名文件

6、,如果找不到,则查找扩展名为.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 crea

7、tes 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 o

8、f 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 af

9、ter the file name.你可以为命令行编译器指定多个参数。一个参数包含一个破折号“-”(或“/”)和紧跟着的一个选项字符构成。通常情况下,选项字符后面会跟一些附加的信息,如一个数字、一个符号、一个目录等。选项可以是任意顺序并且可以在源文件名前面或后面。2 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 sla

10、sh (/) 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 允许你使用菜单来设置各种编译选项,而命令行编译器允许你使用字符“/”作为分隔符来设定这些编译选项。你也可以使用连字符“-”来代替“

11、/” ,但是用 “-”引出的参数之间必须用空格隔开。例如,下面两个命令都是等同的也是合法的: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.第一个编译命令用“-”引出参数,且参数之间有多个空格分隔。第二个编译命令用“/” 引

12、出参数,参数之间不必要分隔。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选

13、项 描述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 addressLEpath 包.BPL 文件输出路径LNpath .dcp 文件输出路径LUpackage 使用运行期间包列表M 编

14、译有改动的源文件Npath dcu/dpu 文件输出目录Opaths .Obj 文件(汇编目标代码文件 )路径P 按 8.3 格式文件名查找Q 安静模式Rpaths 资源文件(.RES)路径TXext 目标文件扩展名Upaths 单元文件路径V 为 Turbo Debugger 生成调试信息文件VN 以.Giant 格式生成包含命名空间的调试信息文件(将用于 C+Builder)VR 生成调试信息文件.rsmW 输出警告信息Z Disable implicit compilation$directive Compiler directives-Help 显示编译选项的帮助。同样的,如果你在命令

15、行单独输入 dcc32,也会显示编译选项的帮助。-version 显示产品名称和版本3 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

16、 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

17、 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 MYSTUF

18、F -$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 directi

19、ves:你可以用多个“$”来指定多个编译器指令,如: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 的格式不一样,你不能在逗号分隔的指令列表中使用$MNot

20、e 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 conditio

21、nal symbols separated by semicolons (;). For example, the following command line:“-D” 选项允许你定义一个编译条件,符合你用$DEFINE symbol定义的编译器指令。“-D”选项后必须跟随一或多个用分号分隔的编译条件符号,如下命令:dcc32 MYSTUFF -DIOCHECK;DEBUG;LISTdefines three conditional symbols, iocheck, debug, and list, for the compilation of MYSTUFF.pas. This is e

22、quivalent to inserting:定义了三个编译条件符号:IOCHECK,DEBUG,LIST, 用于 MYSTUFF.pas 单元中。这等同于在源文件中插入以下语句:$DEFINE IOCHECK$DEFINE DEBUG$DEFINE LISTat the beginning of MYSTUFF.pas. If you specify multiple -D directives, you can concatenate the symbol lists. Therefore:如果你指定了多个“-D”选项,你可以联接它们,如下:dcc32 MYSTUFF -DIOCHECK-

23、DDEBUG-DLISTis equivalent to the first example.等同于第一个例子。4 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.有几个选项能影响编译器自

24、身的功能。像其它选项一个,你可以使用“/”或“-” 的格式。别忘了用至少一个空格分隔这些选项。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 quick

25、er 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,比源文

26、件中的要新;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

27、option are excluded from the make logic.在单元编译时指令“-Z”在构造逻辑期不被接受。If you were applying this option to the previous example, the command would be:如果你在上一个例子中使用这个指令,编译命令就应该是:dcc32 MYSTUFF -MBuild all (-B) option编译所有 选项(-B)Instead of relying on the -M option to determine what needs to be updated, you can t

28、ell command-line compiler to update all units upon which your program depends using the -B option. You cant 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 速度更慢,而且它并不是必需的

29、。If you were using this option in the previous example, the command would be如果你在前一个例子中使用这个参数,编译命令就应该是:dcc32 MYSTUFF -BFind 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 i

30、n 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 选项来指定错误地址,你在源文件中能找到引发错误的位置,如果你的程序和单元编译时附加了调试信息(使

31、用$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 u

32、nits 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

33、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

34、 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

35、 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

36、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 d

37、uring 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.它的输出仅限

38、于起始时行版权信息以及结尾的统计信息。当然,如果发生错误,它也会输出。5 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 in

39、serted 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 comp

40、iler lets you enter the same command-line option several times, ignoring all but the last occurrence. This way, even though youve changed some settings with a configuration file, you can still override them on the command line.命令行编译器允许你输入相同的命令行参数,它将忽略所有除最后一个之外。这个的话,尽管通过配置文件你可以改变一些设置,你仍然可以覆盖它使用命令行参数。

41、When dcc32 starts, it looks for DCC32.CFG in the current directory. If the file isnt found there, dcc32 looks in the directory where DCC32.EXE resides.当 dcc32 启动时,它查找 DCC32.CFG 文件在当前目录。如果文件没有找到,dcc32 会查找它所在的目录。Heres an example DCC32.CFG file, defining some default directories for include, object, an

42、d unit files, and changing the default states of the $O and $R compiler directives:以下是一个 DCC32.CFG 配置文件的例子,定义了关于文件包含、 OBJ 文件包含、单元文件搜索路径信息,并改变了编译器指令$O 和$R 的默认值。-IC:DELPHIINC;C:DELPHISRC-OC:DELPHIASM-UC:DELPHIUNITS-$R+-$O-Now, if you type:现在,如果你输入:dcc32 MYSTUFF the compiler performs as if you had type

43、d the following:编译器把它当作你输入如下命令:dcc32 -IC:DELPHIINC;C:DELPHISRC -OC:DELPHIASM -UC:DELPHIUNITS -$R+ -$O- MYSTUFF6 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.编译器有两个命令行参数可

44、以生成外部调试信息:MAP 文件选项和调试信息选项。Map file (-G) optionsMap 文件(-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

45、 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

46、 或 D,去决定你想要在.map 文件列出的信息。一个.MAP 文件被分成三个节:SegmentPublicsLine 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 keyw

47、ord.-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 Nu

48、mbers section shows line numbers for all procedures and functions in the module. In the $D+,L- state, only symbols defined in a units 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+编译模块(程序或单元),Pu

49、blics 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 Debugge

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报