Thread overview | |||||
---|---|---|---|---|---|
|
January 17, 2006 module | ||||
---|---|---|---|---|
| ||||
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. |
January 18, 2006 Re: module | ||||
---|---|---|---|---|
| ||||
Posted in reply to gdc | 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
|
January 18, 2006 Re: module | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Friedman | 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. |
Copyright © 1999-2021 by the D Language Foundation