[cfe-dev] #include <chrono> with Clang 3.1

Howard Hinnant hhinnant at apple.com
Wed Aug 1 13:21:39 PDT 2012


On Aug 1, 2012, at 9:46 AM, "Hadassi, Ofer" <OHadassi at nds.com> wrote:

> I am using Clang 3.1 on Ubuntu. Compiling this simple program:
> 
> #include <thread>
> int main(int argc, char ** argv)
> {
> retrurn 0;
> }
> 
> using the following command line fails:
> clang++ -std=c++11 - test.cpp
> 
> The failure is due to the inclusion of <chrono> from <thread>. Replacing the
> #include <thread>
> with
> #include <chrono>
> gives the same results.
> 
> Is there a way to work with std::thread using Clang?

<thread> needs <chrono> to support these two functions:

template <class Clock, class Duration>
void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);

template <class Rep, class Period>
void sleep_for(const chrono::duration<Rep, Period>& rel_time);

What is the error you're seeing?

Howard




More information about the cfe-dev mailing list