Boost logo

Boost :

Subject: Re: [boost] [chrono] Help need for Linux implementation
From: Beman Dawes (bdawes_at_[hidden])
Date: 2008-11-10 21:23:38


On Mon, Nov 10, 2008 at 5:39 PM, Sebastian Redl
<sebastian.redl_at_[hidden]> wrote:
> Beman Dawes wrote:
>>
>> I've got a boostified version of the C++0x <chrono> header working on
>> Windows, but need help for the Linux implementation.
>>
>> I wrote a test program (see below). It compiles OK but gets a link
>> failure:
>>
>> /tmp/ccmT80bD.o: In function `clk()':
>> test.cpp:(.text+0x192): undefined reference to `clock_gettime'
>> collect2: ld returned 1 exit status
>>
>> What am I doing wrong? The command I'm using is simply "g++
>> test.cpp". Ubuntu 8.04 with all updates applied.
>>
>
> You need to link against librt.

Thanks! I'd actually tried that, but used -llibrt. But with your
confirmation that librt was the library needed, I eventually tried
-lrt and it worked. I guess dropping the "lib" prefix is something
everyone (except me!) knows.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk