www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Weird RDMD error when trying to import source file from subfolder.

reply BoQsc <vaidas.boqsc gmail.com> writes:
I'm unable to import a `.d` source file from a subfolder.

Now this happens only with `rdmd`.
The `dmd -i -run` works perfectly.

I'm currently on Windows 10 operating system.




**./testimport.d**:

```
import std;
import waffle.next;
void main(){
	writeln("test", testing);
}
```

**./waffle/next.d**:

```
int testing = 5;
```

**Error:**

```
rdmd testimport.d
testimport.d(2): Error: module `next` from file waffle\next.d 
must be imported with 'import next;'
```
Nov 01 2023
parent Julian Fondren <julian.fondren gmail.com> writes:
On Wednesday, 1 November 2023 at 16:24:04 UTC, BoQsc wrote:
 **Error:**

 ```
 rdmd testimport.d
 testimport.d(2): Error: module `next` from file waffle\next.d 
 must be imported with 'import next;'
 ```
You import 'waffle.next', but the module is inferred to be 'next'. If put `module waffle.next;` at the top of next.d, this works.
Nov 01 2023