I'm new to D and got confused with the dmd. I assume I have the following codes in some folder x with all relevant extra files. Should use .di files to import from other modules or the d file itself is sufficient to import a module

In c++, gcc -c x/cmain.cpp wil compile without any error.

****cmain.cpp***
#include <iostream>
#include "chelper.h"

int main(){
  std::cout << "Printing from cmain\n" ;
  chelper_foo("cmain");
  return 0;
}

In D, dmd -c x/dmain.d will complainsabout dhelper.d file which is in the x folder. What should I do to get rid of this error? dmd -c x/dmain.d x/dhelper.d compiles but I do not want that.

****dmain.d***
import std.stdio;
import dhelper;

void main(){
  writefln("Hi from d");
  dhelper_foo("dmain");
}

Reply via email to