In addition, I can't even use a naked -I directive without all the dmd.conf/DFLAGS stuff.<br><br>My module code is in ~/Desktop/src/dashcheck. But even with the -Ipath directive, dmd still can't find it.<br><br><span style="font-family: courier new,monospace;">$ dmd example.d -I~/Desktop/src/dashcheck</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">Undefined symbols for architecture i386:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  "_D9dashcheck12__ModuleInfoZ", referenced from:</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      _D7example12__ModuleInfoZ in example.o</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  "_D9dashcheck9genStringFZAya", referenced from:</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      anon in example.o</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  "_D9dashcheck6genIntFZi", referenced from:</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      anon in example.o</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      _D7example7genEvenFZi in example.o</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">ld: symbol(s) not found for architecture i386</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">collect2: ld returned 1 exit status</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">--- errorlevel 1</span><br clear="all"><div><br></div>Cheers,<div><br></div><div>Andrew Pennebaker</div><div><a href="http://www.yellosoft.us" target="_blank">www.yellosoft.us</a></div>

<br><div class="gmail_quote">On Thu, Oct 27, 2011 at 6:28 PM, Nick Sabalausky <span dir="ltr"><a@a.a></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

"Andrew Pennebaker" <<a href="mailto:andrew.pennebaker@gmail.com">andrew.pennebaker@gmail.com</a>> wrote in message<br>
news:mailman.543.1319752640.24802.digitalmars-d@puremagic.com...<br>
<div class="im">> I've got a single-file D module,<br>
</div>> dashcheck.d<<a href="https://github.com/mcandre/dashcheck" target="_blank">https://github.com/mcandre/dashcheck</a>>,<br>
<div class="im">> that I'd like to install as a local package. In other words, I'd like to<br>
> be<br>
> able to "import dashcheck;" from any directory.<br>
><br>
> I put dashcheck.d in ~/.d/, and I put export DFLAGS=-I~/.d in ~/.profile,<br>
> but when I try to run example.d from another directory, I get:<br>
><br>
> $ ./example.d<br>
> ./example.d(3): Error: module dashcheck is in file 'dashcheck.d' which<br>
> cannot be read<br>
> import path[0] = /usr/local/Cellar/dmd/2.051/src/phobos<br>
> import path[1] = /usr/local/Cellar/dmd/2.051/src/druntime/importCheers,<br>
><br>
> It appears that rdmd ignores $DFLAGS.<br>
><br>
<br>
</div>I guess DFLAGS isn't an env var (which actually surprises me, it probably<br>
should be, is there already an enhancement request in bugzilla for that? Is<br>
is there some deliberate reason for this?).<br>
<br>
DFLAGS is normally set in your dmd.conf file (sc.ini on Windows). Do a<br>
"which dmd" to see where your dmd binary is, and your dmd.conf will be in<br>
the same directory (at least if you used the .zip releases or DVM, I don't<br>
know where the distros will put dmd.conf).<br>
<br>
Another approach that many of us use is to just pass the -Ipath option to<br>
dmd or rdmd in your buildscript to tell dmd/rdmd where to look for look for<br>
imports (sort of the D counterpart to Java's classpaths).<br>
<div class="im"><br>
> Also, when I change the shebang in example.d to #!/usr/bin/env rdmd<br>
> $DFLAGS,<br>
> I get:<br>
><br>
> $ ./example.d<br>
> sh: -I~/.d.d.deps: No such file or directory<br>
><br>
> So I'm not using import directives correctly. How do I generate<br>
> dashcheck.d.deps?<br>
><br>
<br>
</div>Part of the problem here is the same as above, DFLAGS needs to be set in<br>
dmd.conf, not an env var. But also, when you use rdmd as a shebang, you<br>
should use the --shebang option (always as the first argument), ie:<br>
<br>
#!/usr/bin/env rdmd --shebang {whatever other options here}<br>
<br>
Apperently, shebangs tend to mess up the params that get sent to rdmd, and<br>
the --shebang makes it use an alternate approach made specifically for that<br>
situation.<br>
<br>
<br>
<br>
</blockquote></div><br>