How to handle differrnt modules which has same file name ?

Regan Heath regan at netmail.co.nz
Tue Nov 20 04:16:49 PST 2007


z_axis wrote:
> For ezample, the directory is as below:
> d:\src\p1\a.d
> d:\src\p2\a.d
> 
> d:\src\test.d
> 
> import p1.a;
> import p2.a;
> 
> void main(char[][] args) {
> //...
> }
> 
> 
> d:\src\dmd -O -release -w -L/SUBSYSTEM:windows:5 test.d p1\a.d p2\a.d
> 
> compling is ok however cannot link !!!  because p2.a.obj will overwrite 
> p1.a.obj. then there is only one a.obj in d:\src !!!
> what is the best way to solve this problem ?

It seems odd to me that DMD is creating all object files in the 
execution path.  I remember having similar issues with make/cc on 
certain UNIX os's and having to use special makefile syntax to cause obj 
files to appear in the same directory as the source.

That is essentially what you want to do here, and you can do it by 
compiling each a.d file seperately, eg.

cd \src\p1
dmd -c a.d
cd \src\p2
dmd -c a.d
cd \src
dmd -O -release -w -L/SUBSYSTEM:windows:5 test.d p1\a.obj p2\a.obj

You should think about using a build tool like rebuild, bud, etc.  I 
would hope they can handle this sort of situation.

Regan


More information about the Digitalmars-d-learn mailing list