linking external libs

FreeSlave via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 2 05:56:29 PDT 2015


On Thursday, 2 July 2015 at 12:47:52 UTC, Nicholas Wilson wrote:
> On Thursday, 2 July 2015 at 12:19:06 UTC, Steven Schveighoffer 
> wrote:
>> On 7/2/15 8:10 AM, Nicholas Wilson wrote:
>>> [...]
>>
>> Try dmd -v, it will tell you the link line. Then you can try 
>> it yourself to see how to get it to work. I know dmd has 
>> problems with link line parameters, because it always puts 
>> Phobos somewhere. But this is generally for libraries that 
>> Phobos needs, not user code.
>>
>> A full example may be useful too.
>>
>> -Steve
>
> linker command is
> gcc test2.o -o test -m64 -L/usr/share/dmd/lib -L/usr/local/lib 
> -lgmp -lphobos2 -L/Users/nicholaswilson/d/lib/ -lphobos2 
> -lpthread -lm

Are you on OSX? (I consider it from /Users instead of /home) Try 
export LIBRARY_PATH=/usr/local/lib.
Can you build C application linked to libgmp this way?


More information about the Digitalmars-d-learn mailing list