building a D app with multiple source files

Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 5 00:38:08 PDT 2014


On Tuesday, 5 August 2014 at 07:29:46 UTC, nikki wrote:
> edit : btw, I understand how to build an app that conscists out 
> of a few source files, I'd just do 'dmd file1.d file2.d' I 
> amtalking here about the situation where that's unpractical 
> because of the amount and folder structure.

You can take a look at the dub build tool to automate all this 
(as mentioned above). Dub works by compiling and linking 
everything together in your source folder. You specify the main 
entry point in a dub.json file. It's pretty easy to use and good 
for handling dependencies over the internet.

To compile things manually you can use rdmd to automatically 
parse the files that need compiling. When using rdmd you only 
need to specify the file that contains the main function to build 
everything around it. for example:

rdmd program.d

This will pull in all imports inside program.d and compile and 
link them too.


More information about the Digitalmars-d-learn mailing list