[linux, ubuntu] personal D module not found in the same directory
le TeXnicien de surface
le.texnicien.de.surface at chezmoi.invalid
Tue Jun 26 09:55:56 PDT 2012
hello all
I'm begining to learn to program with D.
I've made this tiny module written in file truc.d
<module>
module truc;
double carre(double x){
return x*x;
}
</module>
and this tiny program written in file jeteste.d
<prgm>
import truc; // I've also tried import T = truc;
import std.stdio;
double cube(double x){
return x*x*x;
}
void main(){
double y = 5;
auto z = carre(y);
// alt version :
// auto z = T.carre(y);
writeln("vu ici ",z);
}
</prgm>
Both files are in the same directory.
I run dmd jeteste.d in the said directory
and I obtain this message:
jeteste.o: In function `_Dmain':
jeteste.d:(.text._Dmain+0x1e): undefined reference to
`_D4truc5carreFdZd'
collect2: ld a retourné 1 code d'état d'exécution
--- errorlevel 1
where do I err?
any hint would be greatly appreciated
many thanks in advance
More information about the Digitalmars-d-learn
mailing list