| Thread overview | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
March 29, 2009 New to D: Building multiple files | ||||
|---|---|---|---|---|
| ||||
Alright so I'm not too familiar with building D or having to build multiple files from the command line (Java usually takes care of that). Basically I have a small game I put together as a test project. Here's the structure: clo/clo.d clo/Main.d clo/common/GameState.d clo is in module clo , while GameState is in module clo.common. Main.d imports both clo and clo.common I'm using the latest 'Easy D' installation on windows (so I've been building simple single files with dsss build (filename). I'm just assuming building Main.d would grab the other stuff and build that (like Java or C#), but I get the following. C:\Users\me\Projects\clo> dsss build Main.d Main.d => Main + C:\dmd\dsss\bin\rebuild.exe -Idsss_imports\ -I. -S.\ - IC:\dmd\dsss\include\d - SC:\dmd\dsss\lib\ -IC:\dmd\dsss\include\d -SC:\dmd\dsss\lib - oqdsss_objs\D Ma in.d -ofMain Command C:\dmd\dsss\bin\rebuild.exe returned with code 1, aborting. Error: Command failed, aborting. Listing all the files to build doesn't prove to be much better: C:\Users\me\Projects\clo> dsss build -v Main.d clo.d commo n\GameState.d Main.d => Main + C:\dmd\dsss\bin\rebuild.exe -Idsss_imports\ -I. -S.\ - IC:\dmd\dsss\include\d - SC:\dmd\dsss\lib\ -v -IC:\dmd\dsss\include\d -SC:\dmd\dsss\lib - oqdsss_objs\D Main.d -ofMain parse Main meta Main import clo (clo.d) Command C:\dmd\dsss\bin\rebuild.exe returned with code 1, aborting. Error: Command failed, aborting. (I jsut guessed -v was verbose) Any help/suggestions would be greatly appreciated. Thanks | ||||
March 29, 2009 Re: New to D: Building multiple files | ||||
|---|---|---|---|---|
| ||||
Posted in reply to chris | How do you import the modules? You must specify the correct name, i.e. import clo.clo; Oh and you should get familiar with the dsss.conf file. This is the way you normally build your project. http://www.dsource.org/projects/dsss/wiki/DSSSForSoftwareEngineers | |||
March 29, 2009 Re: New to D: Building multiple files | ||||
|---|---|---|---|---|
| ||||
Posted in reply to chris | On 29.03.2009 17:04, chris wrote: > Alright so I'm not too familiar with building D or having to build > multiple files from the command line (Java usually takes care of > that). Basically I have a small game I put together as a test > project. Here's the structure: > > clo/clo.d > clo/Main.d > clo/common/GameState.d > > clo is in module clo , while GameState is in module clo.common. > > Main.d imports both clo and clo.common > > I'm using the latest 'Easy D' installation on windows (so I've been > building simple single files with dsss build (filename). I'm just > assuming building Main.d would grab the other stuff and build that > (like Java or C#), but I get the following. > [...] > > C:\Users\me\Projects\clo> dsss build -v Main.d clo.d commo > n\GameState.d I don't know if dsss supports building without a config file. Just doing 'rebuild Main.d' should work. Or 'dmd Main.d clo.d common\GameState.d'. Make sure that Gamestate.d has a 'module common.GameState;' declaration. | |||
March 29, 2009 Re: New to D: Building multiple files | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Trass3r | The file clo.d is in module clo; while GameState is in module slo.common; I just import clo; and import clo.common; when using stuff in either of those files, I hope that's correct. Also thanks for the link, I was going to ask about .conf files. | |||
March 29, 2009 Re: New to D: Building multiple files | ||||
|---|---|---|---|---|
| ||||
Posted in reply to chris | chris schrieb: > The file clo.d is in module clo; while GameState is in module > slo.common; > you probably mean it is in package clo. > Also thanks for the link, I was going to ask about .conf files. > You're welcome. | |||
March 30, 2009 Re: New to D: Building multiple files | ||||
|---|---|---|---|---|
| ||||
Posted in reply to chris | chris wrote:
> Alright so I'm not too familiar with building D or having to build
> multiple files from the command line (Java usually takes care of
> that). Basically I have a small game I put together as a test
> project. Here's the structure:
>
> clo/clo.d
> clo/Main.d
> clo/common/GameState.d
>
> clo is in module clo , while GameState is in module clo.common.
>
> Main.d imports both clo and clo.common
>
> I'm using the latest 'Easy D' installation on windows (so I've been
> building simple single files with dsss build (filename). I'm just
> assuming building Main.d would grab the other stuff and build that
> (like Java or C#), but I get the following.
>
> C:\Users\me\Projects\clo> dsss build Main.d
> Main.d => Main
> + C:\dmd\dsss\bin\rebuild.exe -Idsss_imports\ -I. -S.\ -
> IC:\dmd\dsss\include\d -
> SC:\dmd\dsss\lib\ -IC:\dmd\dsss\include\d -SC:\dmd\dsss\lib -
> oqdsss_objs\D Ma
> in.d -ofMain
> Command C:\dmd\dsss\bin\rebuild.exe returned with code 1, aborting.
> Error: Command failed, aborting.
>
> Listing all the files to build doesn't prove to be much better:
>
> C:\Users\me\Projects\clo> dsss build -v Main.d clo.d commo
> n\GameState.d
> Main.d => Main
> + C:\dmd\dsss\bin\rebuild.exe -Idsss_imports\ -I. -S.\ -
> IC:\dmd\dsss\include\d -
> SC:\dmd\dsss\lib\ -v -IC:\dmd\dsss\include\d -SC:\dmd\dsss\lib -
> oqdsss_objs\D
> Main.d -ofMain
> parse Main
> meta Main
> import clo (clo.d)
> Command C:\dmd\dsss\bin\rebuild.exe returned with code 1, aborting.
> Error: Command failed, aborting.
>
> (I jsut guessed -v was verbose)
>
> Any help/suggestions would be greatly appreciated.
>
> Thanks
I think the problem here is that you are trying to build from within the package hierarchy. Your imports aren't being found because the compiler (or DSSS?) is searching for clo\clo\clo.d and clo\clo\common\GameState.d. You have two options.
1) CD one level up to C:\Users\me\Projects and run the command like so:
dsss build clo/Main.d
2) stay where you are and tell the compiler where to find the imports via the -I switch (sort of like the Java classpath)
dsss build Main.d -I..
Using .. here will cause it to look in C:\Users\me\Projects for the clo hierarchy.
I second the recommendation that you start using DSSS configuration files to manage project builds. I tend to structure my D projects like so:
- ProjectName
- src (project-specific package tree)
- MyPackage
- MySubPackage
- AnotherSubPackage
- import (third-party packages)
- libPackage (like, maybe, derelict)
- anotherLibPackage
- dist (the binary and other distributables)
Then, in the ProjectName directory, I keep a dsss.conf file with the build configuration. Something like this:
[src/MyPackage/Main.d]
target=dist/MyApp
buildflags=-Iimport -clean
Then, from the ProjectName directory I just run
dsss build
DSSS reads the configuration file and does its thing.
| |||
March 30, 2009 Re: New to D: Building multiple files | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | Yea I just realized it follows the directory structure and not some arbitrary system I made up. Thanks for the .config info, I was just putting one together of similar structure, this'll absolutely help. Much appreciated | |||
April 02, 2009 Re: New to D: Building multiple files | ||||
|---|---|---|---|---|
| ||||
Posted in reply to torhu | On Sun, 29 Mar 2009 17:43:51 +0200, torhu wrote:
> On 29.03.2009 17:04, chris wrote:
>> Alright so I'm not too familiar with building D or having to build multiple files from the command line (Java usually takes care of that). Basically I have a small game I put together as a test project. Here's the structure:
>>
>> clo/clo.d
>> clo/Main.d
>> clo/common/GameState.d
>>
>> clo is in module clo , while GameState is in module clo.common.
>>
>> Main.d imports both clo and clo.common
>>
>> I'm using the latest 'Easy D' installation on windows (so I've been
>> building simple single files with dsss build (filename). I'm just
>> assuming building Main.d would grab the other stuff and build that
>> (like Java or C#), but I get the following.
>>
> [...]
>>
>> C:\Users\me\Projects\clo> dsss build -v Main.d clo.d commo n\GameState.d
>
> I don't know if dsss supports building without a config file. Just doing 'rebuild Main.d' should work. Or 'dmd Main.d clo.d common\GameState.d'.
>
> Make sure that Gamestate.d has a 'module common.GameState;' declaration.
Yes DSSS can build without a conf file. I think it basically passes the command to rebuild.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply