dmd vs rdmd

Joshua Niehus jm.niehus at
Fri Jun 10 14:28:41 PDT 2011


I am trying to compile code which is composed of two modules (in the same


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;

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
$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...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Digitalmars-d-learn mailing list