Linking to static libraries

Jacob Carlborg doob at me.com
Thu May 10 06:14:35 PDT 2012


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

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list