dmd compile with imported modules

spir denis.spir at gmail.com
Sat Jan 1 07:07:12 PST 2011


On Sat, 1 Jan 2011 13:34:47 +0000 (UTC)
useo <useo at start.bg> wrote:

> Hey guys,
> 
> I've the following problem... when I write a simple class, for
> example:
> 
> ...
> module myclasses.exampleClass;
> 
> class exampleClass {
> void writeHelloWorld() {
> writeln("Hello World");
> }
> 
> And import myclasses.exampleClass in the following:
> 
> ...
> module mainfile;
> 
> import myclasses.exampleClass;
> 
> void main(string[] args) {
> exampleClass ec = new exampleClass();
> ec.writeHelloWorld();
> }
> ...
> 
> I always have to compile the mainfile-module with "dmd mainfile.d
> myclasses/exampleClass.d" because of the obj-files. My projects are
> always growing and I don't want list all 100 or more classes/files in
> the command line. Is there any possibility to automatically import,
> compile and link all the files with a short command?
> 
> Thanks in advance!

dmd automatically builds with imported modules from the std lib, but only them.
rdmd is what you're looking for: see http://www.digitalmars.com/d/2.0/rdmd.html. It will forward dmd's command-line switches correctly. For instance, my dev-time build command is:
	rdmd -w -debug -unittest --build-only -of"%e" "%f"
where %e is source filename with ext, %f without ext.

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d-learn mailing list