I am trying to compile a simple lib, and a simple demo using this lib.

So I have 2 directories at the same level in the same DEV directory:
   demo1          Dterrent

In the Dterrent directory, the dub.json is pretty common, compiling as a lib:
        "name": "dterrent",
        "targetPath": "libs",

Inside Dterrent, I also have a regular "source" directory, which contains a package.d file:
Dterrent
|-> source
  |-> package.d

The first line of package.d is :
module dterrent;

If I am in the Dterrent directory, a `dub build` command compiles the library dterrent properly, exactly as expected.

***

I go back up to DEV, then go down into demo1. There I have again a dub.json file, with :
        "dependencies": {
                 ...
                 "dterrent" : { "path": "../Dterrent" },

In the demo1 directory, I also have a regular source/app.d file, whose first line is:
import dterrent;

Then I try a `dub build`:
----
jerome@laptop:/DATA/DEV/demo1$ dub build
Performing "debug" build using /home/jerome/dlang/dmd-2.093.1/linux/bin64/dmd for x86_64. dterrent ~master: target for configuration "library" is up to date.
demo1 ~master: building configuration "application"...
source/app.d(9,8): Error: module dterrent is in file 'dterrent.d' which cannot be read
import path[0] = source/
import path[4] = ../Dterrent/source/
import path[5] = /home/jerome/dlang/dmd-2.093.1/linux/bin64/../../src/phobos import path[6] = /home/jerome/dlang/dmd-2.093.1/linux/bin64/../../src/druntime/import /home/jerome/dlang/dmd-2.093.1/linux/bin64/dmd failed with exit code 1.
----

Well, the module dterrent is obviously not in dterrent.d
dterrent.d does not exist as it, since it is a package.d file with the "module dterrent;" line.

If I change package.d for dterrent.d, I get some other errors. But at this point, I think we agree I should not have to change the name of package.d, right?

What am I doing wrong? What would be the right way? Or is there a workaround.

Thanks

Reply via email to