dmd vs rdmd
Joshua Niehus
jm.niehus at gmail.com
Fri Jun 10 14:28:41 PDT 2011
Hello,
I am trying to compile code which is composed of two modules (in the same
directory):
main.d
foo.d
foo.d just declares a class Foo which has a string variable "bar" which i
set to "hello" and main.d just prints bar's value to the console:
// --------- main.d -----------
import std.stdio, foo;
void main() {
Foo f = new Foo;
writeln(f.bar);
}
When i attempt to compile main.d via:
$dmd main.d
I get undefined symbol errors.
But when I run:
$rdmd main.d
it works as expected.
The only way I could get main.d to compile with just dmd was to compile foo
as a lib first and then compile main.d and passing the foo.a file as an
argument:
$dmd -lib foo.d
$dmd main.d foo.a
Is this normal?
I got the impression from TDPL (Alexandrescu) that the dmd compiler would
automatically search the root directory, find foo.d, work its magic, and
create all the symbols that were defined in foo.d for main.d to compile...
Thanks,
Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20110610/dccf485f/attachment.html>
More information about the Digitalmars-d-learn
mailing list