www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - error when attempting unittest

reply "Patrick Tinkham" <patrick_tinkham yahoo.com> writes:
When I try to compile a unittest on the following:

import std.stdio;
class A {
   int x = 42;
}

unittest {
   auto a1 = new A;
   assert (a1.x == 42);
   auto a2 = a1;
   a2.x = 100;
   assert (a1.x == 100);
}

I get the following:

patrick patrick-desktop:~/d$ rdmd --main -unittest c.d
/usr/bin/ld: cannot find -lcurl
collect2: ld returned 1 exit status
--- errorlevel 1
patrick patrick-desktop:~/d$


I assume that I am missing something. But what?
Mar 23 2013
parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Sunday, March 24, 2013 01:03:40 Patrick Tinkham wrote:
 When I try to compile a unittest on the following:
 
 import std.stdio;
 class A {
    int x = 42;
 }
 
 unittest {
    auto a1 = new A;
    assert (a1.x == 42);
    auto a2 = a1;
    a2.x = 100;
    assert (a1.x == 100);
 }
 
 I get the following:
 
 patrick patrick-desktop:~/d$ rdmd --main -unittest c.d
 /usr/bin/ld: cannot find -lcurl
 collect2: ld returned 1 exit status
 --- errorlevel 1
 patrick patrick-desktop:~/d$
 
 
 I assume that I am missing something. But what?
That's a linker error telling you that the linker can't find libcurl, which means that you haven't installed curl or that it's not installed somewhere where the linker looks. Given that curl is something that should normally be installed on a Linux box and would be installed by the system's package manager, my guess is that you don't have curl installed - or that if you do, you don't have the devel package installed (if your distro has separate devel packages). - Jonathan m Davis
Mar 23 2013
parent "Patrick Tinkham" <patrick_tinkham yahoo.com> writes:
On Sunday, 24 March 2013 at 01:56:31 UTC, Jonathan M Davis wrote:
 On Sunday, March 24, 2013 01:03:40 Patrick Tinkham wrote:
 When I try to compile a unittest on the following:
 
 import std.stdio;
 class A {
    int x = 42;
 }
 
 unittest {
    auto a1 = new A;
    assert (a1.x == 42);
    auto a2 = a1;
    a2.x = 100;
    assert (a1.x == 100);
 }
 
 I get the following:
 
 patrick patrick-desktop:~/d$ rdmd --main -unittest c.d
 /usr/bin/ld: cannot find -lcurl
 collect2: ld returned 1 exit status
 --- errorlevel 1
 patrick patrick-desktop:~/d$
 
 
 I assume that I am missing something. But what?
That's a linker error telling you that the linker can't find libcurl, which means that you haven't installed curl or that it's not installed somewhere where the linker looks. Given that curl is something that should normally be installed on a Linux box and would be installed by the system's package manager, my guess is that you don't have curl installed - or that if you do, you don't have the devel package installed (if your distro has separate devel packages). - Jonathan m Davis
That fixed it. Thank you so much! (And apologies for posting in the wrong thread earlier)
Mar 23 2013