On Monday, 21 June 2021 at 13:29:59 UTC, Steven Schveighoffer wrote:

It does work. However, you have to tell the compiler the file to compile.

When an import is used, the compiler does 2 stages:

1. Search through already-seen modules, and see if one matches
2. Search the filesystem to find a file that fits the module name. For example `std.path` becomes `$INCLUDE_DIR/std/path.d`

So if you provide the file name to the compiler as part of the set of files to compile, it should work. e.g:

foo-bar.d:
```d
module foo_bar;
```

app.d:
```d
module app;
import foo_bar;

void main () {}
```

compiled like:

```
> dmd app.d foo-bar.d
```

That being said, I strongly recommend just to name the file the same as the module name.

-Steve

Ironically I was already doing this on a shell script carrying all my source file names and switches for DMD, but since I started to, I did not retest changing back the names on the file system to a-b-c. I changed them right now and it works flawlessly. Issue solved. Thanks for the tip Steve :) !

Reply via email to