On Tue, 27 Sep 2016 18:56:47 GMT, o3o wrote:
In order to understand how subpackage works I have created a simple project.
So, if I set module name:
/* in insects/src/bee.d */ module insect.bee; ...
dmd complains about module
bee
$ dub src/app.d(1,8): Error: module bee is in file 'insects/bee.d' which cannot be read
If I remove module name
/* in insects/src/bee.d */ //module insect.bee; ...
and import just file name:
// in src/app.d //import insects.bee; import bee; void main() { ...
it works.
So, I cannot use
module
declaration in my subpackage?Thanks
The directory structure must correspond to the fully qualified module name in order for the compiler to be able to find it. So in this case you'd have to put the bee.d file in a sub folder src/insects/ instead of directly into src/. It unfortunately creates a bit of redundancy, but there is usually no way around it (always compiling with dub build --combined
would also make it work, but that's a rather questionable workaround).