My project structure is the following:
Test
|
+-- pack
| |
| +-- file1.d
| |
| +-- file2.d
|
+-- program.d
And here is the code inside these files:
// file2.d
package int value = -120;
// file1.d
void printlnValueInFile2() {
import std.stdio: writeln;
import pack.file2: value;
writeln(value);
}
// program.d
void main() {
import pack.file1;
printlnValueInFile2(); // -120 expected
}
From the directory Test when I'm trying to compile the project with command
gdc -o program program.d pack/file1.d pack/file2.d
, it produces 3 errors with the following messages:
- module
file1
from filepack/file1.d
must be imported with 'import file1;
' (instead of 'import pack.file1
') - module
file2
from filepack/file2.d
must be imported with 'import file2;
' (instead of 'import pack.file2
')
Don't you need to provide a full path to these files relatively to the directory where the compilation process takes place (Test)?
- module
file2
member 'value
' is not visible from module 'file1
' (however, both files are in the same directory)