On Tue, Jul 26, 2011 at 2:02 AM, Dainius (GreatEmerald)
<past...@gmail.com>wrote:

> I must be missing something incredibly obvious here, but I can't find
> out what it is... I'm trying to build a very simple test program for
> LuaD, right now it simply imports the library. But it throws a linker
> error for some reason. Here's the program I'm trying to compile:
>
>    import std.stdio;
>    import luad.all;
>
>    int main()
>    {
>        readln();
>        return 0;
>    }
>
> This is what I use to compile it:
>
>    dmd -ILuaD LuaTest.d
>
> This is the error it gives me:
>
>    LuaTest.o:(.data+0x18): undefined reference to
> `_D4luad3all12__ModuleInfoZ'
>    collect2: ld returned 1 exit status
>    --- errorlevel 1
>
> I got LuaD by simply performing a git clone from here:
> https://github.com/JakobOvrum/LuaD
> Using Linux, DMD64 v2.053.
>

DMD will parse files you import, but won't generate output for them unless
you specify them on the command line. If you want it to generate code for
luad.all (which is what the linker says is missing), you need to compile
like this:
dmd -ILuaD LuaTest.d LuaD/luad/all.d
There are probably other files you need in LuaD, so you might try generating
a lib:
dmd -ILuaD -lib -ofLuaD.lib LuaD/luad/*.d [insert other paths as
appropriate]
Which you can then use like this:
dmd -ILuaD LuaTest.d LuaD.lib

Reply via email to