I am trying to use a base module importing into D (language version 2). As a guide, I used an example on dlang.org, but my simple program will not compile. Files are in the same directory.
Here is my main.d file:
import std.stdio; import mymodule; void main(string[] args){ sayHello(); writeln("Executing Main"); }
And here is my module file content (mymodule.d):
void sayHello(){ writeln("hello"); }
For compilation, I run through bash:
dmd main.d
And the error output:
main.o: In function `_Dmain': main.d:(.text._Dmain+0x5): undefined reference to `_D8mymodule8sayHelloFZv' collect2: ld returned 1 exit status --- errorlevel 1
Redmage
source share