linking external libs

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 2 06:02:05 PDT 2015


On 7/2/15 8:47 AM, 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

OK, but what I meant was, run this line yourself and see if you can get 
it to link by tweaking things :)

D isn't doing anything magic here. And without full code/environment, 
it's impossible to tell you why this doesn't work.

-Steve


More information about the Digitalmars-d-learn mailing list