在Delphi中编译和构建有什么区别? [英] What is the difference between compiling and building in Delphi?

查看:602
本文介绍了在Delphi中编译和构建有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Delphi-6有两个选项:Build和Compile。



我知道当我运行一个程序时,它只编译已更改的文件,并使用DCU对于那些没有。当我点击build显然是重建DCUs。



我一直想知道的是,当我做一个程序的发布(改变构建设置,条件变量等)



如果我不做一个完整的构建,会发生什么,是否有任何命令?

解决方案

当编译时,何时编译?



编译器只在.pas源文件的datetime戳改变(1,2)时自动重新编译单元。



对项目中的其他状态更改其他编译器设置等),编译器不会自动重新编译。这是当你需要强制一个构建。



当.inc或其他包含的($ I)文件更改(3)时,还需要强制重建,因为未检查其datetime-stamp。



因此,总而言之,除了单位.pas文件之外的任何内容更改时,您需要进行构建。



一些奇怪的案例在建设。多数结果在找不到单元xxx错误,似乎


  1. 当项目中的单元的路径错误时,或者在工作目录错误时使用相对路径。 (请参阅 Delphi调试错误的单元

  2. (我不完全确定这一点,这是一个假设).dcu因为CRCs(1)而被重新编译,但新编译的dcu被放置在不同的目录中。这不是当前编译的问题(因为正确的dcu已经加载),但是在随后的编译(例如,依赖包)中,再次找到旧的dcu文件,并且源not - >错误。 遇到疑问时,通过递归删除所有DCU的

(1)就像FPC,.dcu包含所有dcu的接口部分的CRC,它取决于。这可以用于检查是否有额外的需要重新编译太。例如。由于文件系统操作(移动dcu的)



(2)的专家,看看{$ implicitbuild xx}太



(3)与Delphi相反,FPC会重建.inc更改。 FPC项目在内部大量使用.inc文件,这种变化已经从之前的Delphi支持。
因此,将defineinc文件复制到任何目录中的软件包将无法使用FPC编译,因为它们的大小和CRC通常略有不同。 Indy(10)就是一个很好的例子。


With Delphi-6 there are two options: Build and Compile.

I know when I run a program it compiles only the files which have changed and uses the DCUs for those which haven't. When I click build apparently it rebuilds the DCUs.

What I have been wondering is, when I make a program for release (changing build settings, conditional variables, etc.) can I just compile, or do I have to do a full build?

What happens if I don't do a full build, is there any consiquence?

解决方案

When build, when compile?

The compiler only automatically recompiles units when the datetime stamp of the .pas source files changes (1,2).

On other state changes in the project (directives, debug or other compiler settings etc), the compiler won't automatically recompile. That's when you need to force a build.

You also need to force a rebuild when .inc or other included ($I) files change(3), since their datetime-stamp is not checked.

So in summary, when anything but the unit .pas files changes, you need to do a build.

There are some strange cases in building. Most result in a "can't find unit xxx" error while it appears to be there

  1. one is when the path of the unit in the project is wrong, or uses a relative path while the working directory is wrong. (see Delphi debug a wrong unit )
  2. (I'm not entirely sure about this one, it is a hypothesis) a .dcu is recompiled because of the CRCs (1), but the newly compiled dcu is placed in a different directory. This is not a problem for the current compile (since the correct dcu is already loaded), but in a subsequent compile (e.g. a dependant package) the old dcu file is found again, and the source not -> error. in case of doubt always clean your build dirs by recursively deleting all DCU's

(1) and if Delphi is like FPC, .dcu's contain a CRC of the interface section of all dcu's it depends on. This can be used to check if there is an additional need for recompiles too. E.g. due to filesystem manipulation (moving dcu's about)

(2) for the experts, have a look at {$implicitbuild xx} too

(3) contrary to Delphi, FPC does rebuild on .inc changes. The FPC project heavily uses .inc files internally, this change already dates from before there was Delphi support. As a result, packages that copy the "defines" inc file into any directory won't compile with FPC because they have usually slightly different size and CRC. Indy (10) is a good example of this.

这篇关于在Delphi中编译和构建有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆