std.net.curl is not working?

qznc qznc at web.de
Fri Apr 26 10:42:43 PDT 2013


Fri, 26 Apr 2013 19:25:16 +0200: mab wrote

> Why i get the following Error, when i try to compile a simple "Hello
> World" that imports std.net.curl=
> 
> The Error:
> # dmd hello.d /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In
> function `_D3std3net4curl4Curl19_sharedStaticCtor28FZv':
> std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticCtor28FZv+0xf):
> undefined reference to `curl_global_init'
> /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function
> `_D3std3net4curl4Curl19_sharedStaticDtor29FZv':
> std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticDtor29FZv+0x5):
> undefined reference to `curl_global_cleanup'
> collect2: ld returned 1 exit status --- errorlevel 1
> 
> The Code:
> import std.stdio;
> import std.net.curl;
> 
> void main()
> {
>    writeln("hello world");
> }
> 
> My Testsystem: Debian # uname -a Linux dexplorer 2.6.32-5-amd64 #1 SMP
> Mon Feb 25 00:26:11 UTC 2013 x86_64 GNU/Linux
> 
> curl is installed by apt-get install curl.
> 
> Thanks!

You have to link libcurl via argument:

  dmd hello.d -L-lcurl


More information about the Digitalmars-d-learn mailing list