On Saturday, 22 September 2018 at 01:51:33 UTC, Samir wrote:
main.d:
import isPrime;
void main() {
    isPrime(x);
}

You probably shouldn't name a module the same as a member anyway, and it should also have two names, like "module myproject.isprime;"

But the fix here is to just use the full name.

import isPrime;
void main() {
  isPrime.isPrime(x); // module_name.member_name
}

or change the import:

import isPrime : isPrime; // specify you want the same-named member

Both files are in the same directory. When compiling main.d,

When compiling, be sure to pass both modules to it, or use the dmd -i if on a new version.

dmd -i main.d

or

dmd main.d isPrime.d

main.d:(.text._Dmain[_Dmain]+0x83): undefined reference to `_D7isPrime3isPFiZb'

this likely means you forgot to compile in the isPrime module, so use the above dmd lines

Reply via email to