Building library

Cassio Butrico via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 28 13:20:29 PDT 2014


On Thursday, 28 August 2014 at 19:29:40 UTC, papaboo wrote:
> Hey
>
> I've just started getting into D and so far I'm just messing
> around with it in a small math library.
> However I've run into an issue while trying to build a library
> and linking it with my main file.
>
> My current file and module layout is
> test.d
> src/math/vector.d - module dragonfly.math.vector
> src/math/quaternion.d - module dragonfly.math.quaternion
>
> Compiling with
> $ dmd test.d src/math/vector.d src/math/quaternion.d && ./test
> works perfectly and runs the way I would expect.
>
> I then tried to compile a library as described
> http://ddili.org/ders/d.en/modules.html, so basically
> $ dmd src/math/vector.d src/math/quaternion.d -lib -ofmath -w
> $ dmd math.a test.d && ./test
>
> But this fails with the following error
> test.d(5): Error: module vector is in file
> 'dragonfly/math/vector.d' which cannot be read
>
> I realize I placed my files in a 'src' dir instead of
> 'dragonfly', but shouldn't explicitly declaring the module name
> in vector.d and quaternion.d fix that?
>
> I'm compiling with dmd v 2.065
>
> Hope someone has an answer for me so I can continue 
> experimenting
> with D.

try
in vector.d
type in fist line.
module src.math.vetor;

in quaternion.d
module src.math.quaternion;

save e compile.


More information about the Digitalmars-d-learn mailing list