dmd doesn't work, rdmd --build-only does

Ben Normoyle bnormoyle at gmail.com
Wed Apr 25 10:48:37 PDT 2012


Hi,

I'm trying to compile a file that imports another file of mine in 
the same directory. I know that if I put both of them as 
arguments to dmd (dmd test2.d test.d), it works fine. I was 
trying to get it to work with only putting the file that actually 
executes as the argument (dmd test2.d). However, while it finds 
test.d fine when I try this, it complains about:

test2.obj(test2)
  Error 42: Symbol Undefined _D4test12__ModuleInfoZ
test2.obj(test2)
  Error 42: Symbol Undefined _D4test7__arrayZ

I've seen this in a lot of places, and the only fix I've heard of 
consistently is to give dmd all of your source files when you 
compile.

However, when I run rdmd --build-only, it both finds test.d and 
produces a valid executable.

My questions are these:
1) Why does rdmd --build-only work when dmd doesn't? Does it 
implicitly pass both to the dmd compiler when it finds that test2 
is dependent on test?
2) Is there some way to have dmd emulate this behavior of rdmd, 
or would it be valid to build my executable with rdmd 
--build-only?

Thank you!


More information about the Digitalmars-d mailing list