How do I compile my Delphi project on the command line?

gath picture gath · Dec 3, 2009 · Viewed 23.6k times · Source

Has anyone ever managed to compile their Delphi 6 & 7 (NOT any Delphi > 7 ) projects using the command line?

All the instructions I see are not very clear on what exactly needs to go where!

Am looking for step-by-step kind of instructions.

Answers should be limited to Delphi 6 & 7: I understand Delphi 2006 and > uses MSBuild which is far much easier.

Links are also high appreciated.

Gath

Answer

mghie picture mghie · Dec 3, 2009

This is not difficult to do. I have a standard Delphi 5 install on my machine here, and when I open a command prompt, navigate to the $(DELPHI)\Demos\Threads directory and enter dcc32.exe thrddemo.dpr the application is built on the command line.

For your own project you may need to add some switches to include file directories, output directories, defines or similar things. Running dcc32.exe without parameters gives a list of switches and parameters. It is all described in the documentation, as well.

For repeatability you should create a batch file or a regular Makefile.

Note that both the project cfg file and the common dcc32.cfg in the Delphi directory contain important settings. For some information about how they affect the build see for example this link on Delphi Wikia.