digitalmars.D.learn - Want a module to import from a sister directork; How?
- jwatson-CO-edu (39/39) Feb 14 2023 I have the following directory structure:
- ryuukk_ (6/6) Feb 14 2023 I think you need to do:
- jwatson-CO-edu (4/10) Feb 14 2023 This did the trick. I did not need it when `utils` was the only
- ryuukk_ (4/4) Feb 14 2023 Glad it worked!
- Adam D Ruppe (2/3) Feb 14 2023 this is not true.
- ryuukk_ (2/5) Feb 14 2023 I thought it had to match, that's interesting
I have the following directory structure: ``` ANN/ ANN/mathkit/ ANN/mathkit/package.d ANN/utils/ ANN/utils/package.d ANN/MLP.d ``` I have the following in "ANN/mathkit/package.d": ```d module ANN.mathkit; //... /// Local Imports /// import ANN.utils; //... ``` I have the following in "ANN/MLP.d": ```d import mathkit; //... void main(){ /* ... */ } ``` When I `rdmd MLP.d` I get the following error: ``` mathkit/package.d(7): Error: unable to read module `utils` mathkit/package.d(7): Expected 'ANN/utils.d' or 'ANN/utils/package.d' in one of the following import paths: // ... ``` How do I build my project with these dependencies?: ``` utils --> mathkit --> MLP \ ,^ `---------------' ``` Must I choose a different structure? Should I be using DUB?
Feb 14 2023
I think you need to do: ``` rdmd MLP.d -I ANN/ ``` Basically you need to tell the compiler where your imported packages are
Feb 14 2023
On Tuesday, 14 February 2023 at 17:56:39 UTC, ryuukk_ wrote:I think you need to do: ``` rdmd MLP.d -I ANN/ ``` Basically you need to tell the compiler where your imported packages areThis did the trick. I did not need it when `utils` was the only local import, but I suppose the compiler needs a little more help when sibling packages depend on each other.
Feb 14 2023
Glad it worked! I wonder why DMD doesn't just parse the import and follow its path since module name must correspond to its path Does anyone know?
Feb 14 2023
On Tuesday, 14 February 2023 at 21:23:26 UTC, ryuukk_ wrote:module name must correspond to its paththis is not true.
Feb 14 2023
On Tuesday, 14 February 2023 at 21:55:24 UTC, Adam D Ruppe wrote:On Tuesday, 14 February 2023 at 21:23:26 UTC, ryuukk_ wrote:I thought it had to match, that's interestingmodule name must correspond to its paththis is not true.
Feb 14 2023