On Sun, 23 Aug 2015 16:00:16 +0000, Tony wrote: > Thanks for the replies. It compiles OK with just. However, it isn't > linking: > > /usr/bin/ld: cannot find -lcurl > > > I do have some versions of libcurl on my system: > > /usr/lib/x86_64-linux-gnu/libcurl.so.3 > /usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0 > /usr/lib/x86_64-linux-gnu/libcurl.so.4 > > I see there is a -L option to pass things to the linker > > -Llinkerflag pass linkerflag to link > > but I am not sure how to use it.
I've had the same problem recently. What I did was that I ran `dmd main.d -L-L/usr/lib/x86_64-linux-gnu/ -L-lcurl -v`. It would still fail to link, but I can find the linking command from the verbose output. It was something like this: `gcc main.o -o main -m64 -L/usr/lib/x86_64-linux- gnu/ -lcurl -L/usr/lib/x86_64-linux-gnu -Xlinker --export-dynamic - l:libphobos2.a -lpthread -lm -lrt`. As you can see, -lcurl is there, but it still needs to be added again after -l:libphobos2.a. So just add it again so the command becomes: `gcc main.o -o main -m64 -L/usr/lib/x86_64-linux-gnu/ -lcurl -L/usr/lib/ x86_64-linux-gnu -Xlinker --export-dynamic -l:libphobos2.a -lpthread -lm - lrt -lcurl`. And it links and runs.