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

Nathan Ridge zeratul976 at hotmail.com
Wed Aug 1 22:08:01 PDT 2012


> The errors are:
> /usr/include/c++/4.6/chrono:240:10: error: cannot cast from lvalue of type 'const long long' to rvalue reference type 'rep' (aka 'long long &&'); types are not compatible
> : __r(static_cast<rep>(__rep)) { }
> ^~~~~~~~~~~~~~~~~~~~~~~
> 
> [snip]

You are using libstdc++ as your standard library. It needs to be 
patched [1] to work with clang. Otherwise you can use libc++ [2]
as your standard library which works out of the box with clang.

Note that the patch I linked to is against libstdc++ from gcc 4.7.
It may or may not work with your libstdc++, which appears to be
from gcc 4.6 (at the least you may have to apply the patch 
manually, which isn't a big deal as it's just one line).

Regards,
Nate

[1] http://clang.llvm.org/libstdc++4.7-clang11.patch
[2] http://libcxx.llvm.org/
 		 	   		  



More information about the cfe-dev mailing list