www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Can't compile with 2 packages with the same name (in different modules)

reply Alexandr <sashulika gmail.com> writes:
Hello to all!
like wrote in subj i can't do this =)
here it is code:
http://paste.dprogramming.com/dpi75yap

i need compiling (not rebuild, dsss, etc)

thanks for your help!
Mar 28 2008
parent reply Milke Wey <no.spam example.com> writes:
On Fri, 2008-03-28 at 03:21 -0400, Alexandr wrote:
 Hello to all!
 like wrote in subj i can't do this =)
 here it is code:
 http://paste.dprogramming.com/dpi75yap
 
 i need compiling (not rebuild, dsss, etc)
 
 thanks for your help!

You can try the -op switch: dmd main.d module1/myclass.d module2/myclass.d -op it should put the object files in the same directory as the source files. so the first myclass.o doesn't get overridden by the second one. -- Mike Wey
Mar 28 2008
parent reply "Unknown W. Brackets" <unknown simplemachines.org> writes:
I always wonder why this isn't the default.... sure cluttering dirs up 
with object files is bad but I'd rather have it be the default than make 
people confused....

-[Unknown]


Milke Wey wrote:
 On Fri, 2008-03-28 at 03:21 -0400, Alexandr wrote:
 Hello to all!
 like wrote in subj i can't do this =)
 here it is code:
 http://paste.dprogramming.com/dpi75yap

 i need compiling (not rebuild, dsss, etc)

 thanks for your help!

You can try the -op switch: dmd main.d module1/myclass.d module2/myclass.d -op it should put the object files in the same directory as the source files. so the first myclass.o doesn't get overridden by the second one.

Mar 28 2008
next sibling parent bearophile <bearophileHUGS lycos.com> writes:
Unknown W. Brackets:
 I always wonder why this isn't the default.... sure cluttering dirs up 
 with object files is bad but I'd rather have it be the default than make 
 people confused....

I agree. Bye, bearophile
Mar 29 2008
prev sibling parent reply "Simen Kjaeraas" <simen.kjaras gmail.com> writes:
On Sat, 29 Mar 2008 01:51:40 +0100, Unknown W. Brackets  =

<unknown simplemachines.org> wrote:

 I always wonder why this isn't the default.... sure cluttering dirs up=

 with object files is bad but I'd rather have it be the default than ma=

 people confused....

 -[Unknown]


 Milke Wey wrote:
 On Fri, 2008-03-28 at 03:21 -0400, Alexandr wrote:
 Hello to all!
 like wrote in subj i can't do this =3D)
 here it is code:
 http://paste.dprogramming.com/dpi75yap

 i need compiling (not rebuild, dsss, etc)

 thanks for your help!

dmd main.d module1/myclass.d module2/myclass.d -op it should put the object files in the same directory as the source =


 files. so the first myclass.o doesn't get overridden by the second on=




Following the D module naming might be better, no? i.e module1/myclass.d =3D> module1.myclass.obj. Of course, this might lead to problems with very long file names. -- Simen
Mar 29 2008
next sibling parent Bill Baxter <dnewsgroup billbaxter.com> writes:
Simen Kjaeraas wrote:
 thanks for your help!

dmd main.d module1/myclass.d module2/myclass.d -op it should put the object files in the same directory as the source files. so the first myclass.o doesn't get overridden by the second one.



 Following the D module naming might be better, no?
 i.e module1/myclass.d => module1.myclass.obj.
 Of course, this might lead to problems with very long file names.

DSSS/rebuild does that. --bb
Mar 29 2008
prev sibling parent reply Alexandr <askmymail ifuwant.com> writes:
Simen Kjaeraas Wrote:

 On Sat, 29 Mar 2008 01:51:40 +0100, Unknown W. Brackets  
 <unknown simplemachines.org> wrote:
 
 I always wonder why this isn't the default.... sure cluttering dirs up  
 with object files is bad but I'd rather have it be the default than make  
 people confused....

 -[Unknown]


 Milke Wey wrote:
 On Fri, 2008-03-28 at 03:21 -0400, Alexandr wrote:
 Hello to all!
 like wrote in subj i can't do this =)
 here it is code:
 http://paste.dprogramming.com/dpi75yap

 i need compiling (not rebuild, dsss, etc)

 thanks for your help!

dmd main.d module1/myclass.d module2/myclass.d -op it should put the object files in the same directory as the source files. so the first myclass.o doesn't get overridden by the second one.


Following the D module naming might be better, no? i.e module1/myclass.d => module1.myclass.obj. Of course, this might lead to problems with very long file names. -- Simen

PS: with -op works, thanks a lot!
Mar 30 2008
parent Derek Parnell <derek psych.ward> writes:
On Sun, 30 Mar 2008 05:24:51 -0400, Alexandr wrote:

 Simen Kjaeraas Wrote:
 Following the D module naming might be better, no?
 i.e module1/myclass.d => module1.myclass.obj.
 Of course, this might lead to problems with very long file names.
 
 -- Simen


 can't understand you, be please more explicit

It might be a useful option for the D compiler to name the generated object files based on the source file's package and module names. For instance if you have two source files of the same name but in different directories, and thus in different packages, you could have 'module' statements such as ... module package1.modulename; in one source file and ... module package2.modulename; in the other source file. Then the compiler could generate the object files in a single output directory as ... package1.modulename.obj package2.modulename.obj However this method is not problem free. One problem is that the object file names could be longer than is currently done, and this could be an issue for the command line and other buffer-size constraints in the linker and executable file format. Another issue is that the 'module' statement is optional and often it is omitted. The compiler would then do exactly as is done now ... create two object files with the same name into the same directory. Maybe this could be reduced if it uses the commandline file paths as 'package' names if a module statement is missing??? dmd package1/modulename.d package2/modulename.d -- Derek Parnell Melbourne, Australia skype: derek.j.parnell
Mar 30 2008