views:

580

answers:

3

Running Delphi 2007 (and probably other versions as well, I'm guessing), if I right-click on a project in the Project Manager (either EXE of BPL in this case), there is a "Clean" command above Compile and Build. What exactly does it do?

+11  A: 

To "clean" a build means to delete all intermediate and output files generated by the compiler. Some compilers or IDEs also have a "clean & build" or "rebuild all" option which essentially performs a clean, followed by a build.

When you rebuild an existing project, compilers generally only rebuild files it determines are changed or new. This is, of course, to save time by not completely recompiling the entire project each time. However, sometimes this has problems; you will find your program getting strange errors or not working right. This increases with the number of dependencies within your project - they may not be rebuilt properly. In this case, you will find that cleaning the output and re-building from scratch will solve the problem.

It is also generally recommended to do a clean before building any release versions for the same reason.

lc
+4  A: 

Clean is one of the commands of MSBuild, now used as underlying engine for every compilation or build. This commands removes temporary files (like DCU) but also final output (like EXE).

Marco Cantù
+2  A: 

Yes, it removes the DCU files and the EXE file, BUT it doesn't clean :

  • DCUs in other directories than the project dir (even if the PASes are added included to the project),
  • .MAP file
  • .RES files (compiled from corresponding .RC files)
  • .DRC file
  • .TLB file
  • ...

So, ... the implementation is really, really bad, ....

Using Delphi 2009.

ulrichb
2010 behavior is likewise
FractalizeR