www.digitalmars.com         C & C++   DMDScript  

D.gnu - module

reply gdc <gdc_member pathlink.com> writes:
Hello,  

i have two programms:  
Haupt.d  with code:  

import Module;  

void main() {}  

And Module.d  with no line.  
I put the 2 files in the subdirectory example  


gdc  example/Haupt.d example/Module.d -o example/Haupt  
I get the error message:  
example/Haupt.d:1: module Module cannot read file 'Module.d'  

If i compiled the programm in the directory example, it works fine. 


dmd example/Haupt.d example/Module.d  
compiled fine, without an error too.  
Jan 17 2006
parent reply David Friedman <dvdfrdmn users.ess-eff.net> writes:
gdc wrote:
 Hello,  
 
 i have two programms:  
 Haupt.d  with code:  
 
 import Module;  
 
 void main() {}  
 
 And Module.d  with no line.  
 I put the 2 files in the subdirectory example  
 
 
 gdc  example/Haupt.d example/Module.d -o example/Haupt  
 I get the error message:  
 example/Haupt.d:1: module Module cannot read file 'Module.d'  
 
 If i compiled the programm in the directory example, it works fine. 
 
 
 dmd example/Haupt.d example/Module.d  
 compiled fine, without an error too.  
 
 
 
This is a limitation of the gdc compiler which can only produce one object file at a time. Here are two workarounds: 1. Use the gdmd script and the -fall-sources option: gdmd -fall-sources example/Haupt.d example/Module.d The down side of -fall-sources is that it is much slower if there many source files on the command line. 2. Add the example directory to the module search path: gdc -I example example/Haupt.d example/Module.d -o example/Haupt David
Jan 17 2006
parent nobody <nobody_member pathlink.com> writes:
In article <dqk4dv$2c9b$1 digitaldaemon.com>, David Friedman says... 
 
gdc wrote: 
 Hello,   
  
 i have two programms:   
 Haupt.d  with code:   
  
 import Module;   
  
 void main() {}   
  
 And Module.d  with no line.   
 I put the 2 files in the subdirectory example   
  
  
 gdc  example/Haupt.d example/Module.d -o example/Haupt   
 I get the error message:   
 example/Haupt.d:1: module Module cannot read file 'Module.d'   
  
 If i compiled the programm in the directory example, it works fine.  
  
  
 dmd example/Haupt.d example/Module.d   
 compiled fine, without an error too.   
  
  
  
This is a limitation of the gdc compiler which can only produce one object file at a time. Here are two workarounds: 1. Use the gdmd script and the -fall-sources option: gdmd -fall-sources example/Haupt.d example/Module.d The down side of -fall-sources is that it is much slower if there many source files on the command line. 2. Add the example directory to the module search path: gdc -I example example/Haupt.d example/Module.d -o example/Haupt David
Thank you. Both examples run fine.
Jan 17 2006