www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - dmd doesn't work, rdmd --build-only does

reply "Ben Normoyle" <bnormoyle gmail.com> writes:
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!
Apr 25 2012
parent reply "Nick Sabalausky" <SeeWebsiteToContactMe semitwist.com> writes:
"Ben Normoyle" <bnormoyle gmail.com> wrote in message 
news:oudhxtazmxlequxpunzw forum.dlang.org...
 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.
dmd only compiles the files you give it.
 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?
Yes.
 2) Is there some way to have dmd emulate this behavior of rdmd,
I hope so. Some people would like to see dmd start doing this, at least as an option. I don't know what Walter thinks of that though.
 or would it be valid to build my executable with rdmd --build-only?
Certainly. That's what I normally do.
Apr 25 2012
parent "Ben Normoyle" <bnormoyle gmail.com> writes:
Thanks for the quick response! I personally would like to have 
that as an option for dmd as well, but if rdmd --build-only 
works, I'll stick to that. Thanks again.


On Wednesday, 25 April 2012 at 18:00:58 UTC, Nick Sabalausky 
wrote:
 "Ben Normoyle" <bnormoyle gmail.com> wrote in message
 news:oudhxtazmxlequxpunzw forum.dlang.org...
 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.
dmd only compiles the files you give it.
 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?
Yes.
 2) Is there some way to have dmd emulate this behavior of rdmd,
I hope so. Some people would like to see dmd start doing this, at least as an option. I don't know what Walter thinks of that though.
 or would it be valid to build my executable with rdmd 
 --build-only?
Certainly. That's what I normally do.
Apr 25 2012