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

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

问题描述

使用Delphi-6有两个选项:构建和编译。



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



我一直在想的是,当我制作一个程序发布(更改构建设置,条件变量等)我可以编译,还是要做一个完整的编译?



如果我不做一个完整的构建,会有什么结果? >

解决方案

编译时编译?



当.pas源文件的日期戳记改变时,编译器只会自动重新编译单位(1,2)。



在项目的其他状态更改(指令,调试或其他编译器设置等),编译器将不会自动重新编译。那就是当你需要强制一个构建。



当.inc或其他包含的($ I)文件更改(3)时,您还需要强制重建,因为它们的日期时间戳未被选中。 >

所以总结来说,除了单位.pas文件之外的任何东西都会发生变化,你需要做一个build。



一些奇怪的案件在建设。大部分的结果是找不到单位xxx错误,似乎在那里


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

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

  3. ,始终清理您的构建目录,在.dpr
  4. $ b中提及了错误的路径$ b

(1)如果Delphi类似于FPC,则.dcu包含所有dcu的接口部分的CRC。这可以用来检查是否还需要重新编译。例如。由于文件系统操作(移动dcu的关于)



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



(3)与Delphi相反,FPC对.inc进行重新修改。 FPC项目在内部大量使用.inc文件,这一变化已经在Delphi支持之前。
因此,将定义inc文件复制到任何目录的软件包将无法使用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
  3. the unit is mentioned with a wrong path in the .dpr

(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天全站免登陆