My project structure is the following:

```
Test
|
+-- pack
|   |
|   +-- file1.d
|   |
|   +-- file2.d
|
+-- program.d
```

And here is the code inside these files:

```d
// file2.d
package int value = -120;
```

```d
// file1.d
void printlnValueInFile2() {
    import std.stdio: writeln;
    import pack.file2: value;

    writeln(value);
}
```

```d
// 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 file `pack/file1.d` must be imported with '`import file1;`' (instead of '`import pack.file1`') - module `file2` from file `pack/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)
  • GDC Compilation ... Murloc via Digitalmars-d-learn
    • Re: GDC Com... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: GDC... Murloc via Digitalmars-d-learn
        • Re:... Mike Parker via Digitalmars-d-learn

Reply via email to