Linking to static libraries
Minas
minas_mina1990 at hotmail.co.uk
Thu May 10 06:21:47 PDT 2012
On Thursday, 10 May 2012 at 13:14:36 UTC, Jacob Carlborg wrote:
> On 2012-05-10 14:55, Minas wrote:
>> I have a static library (libDerelictSDL2.a) in
>> /usr/lib/Derelict3. What
>> I want to to is just link to that. My code does not use
>> anything from it.
>>
>> My .d file is icy.d.
>>
>> I try to compile using:
>>
>> a) dmd icy.d -I/usr/lib/Derelict3 -L-lDerelictSDL2
>> b) dmd icy.d -L-I/usr/lib/Derelict3 -L-lDerelictSDL2
>> c) dmd icy.d -L-lDerelictSDL2
>>
>> None works, and the error is:
>>
>>
>>
>> /usr/bin/ld: cannot find -lDerelictSDL2
>> collect2: ld returned 1 exit status
>> --- errorlevel 1
>>
>> Why can't it find it? I have set the linker's path correctly
>> (I think).
>
> Try:
>
> $ dmd icy.d -L-L/usr/lib/Derelict3 -L-lDerelictSDL2
>
> You can also supply the library directly:
>
> $ dmd icy.d /usr/lib/Derelict3/DerelictSDL2
Thank you very much!!
> $ dmd icy.d -L-L/usr/lib/Derelict3 -L-lDerelictSDL2
This works fine!
$ dmd icy.d /usr/lib/Derelict3/DerelictSDL2
This doesn't because dmd thinks that I'm talking about a .d file.
More information about the Digitalmars-d-learn
mailing list