std::chrono
应该在g++ 4.8.*
中支持。但是,当我尝试使用它编译使用g++ 4.8.3
时,它找不到各种声明。我当然在使用-std=c++11
。g ++ 4.8。* std :: chrono Undeclared
例如这个调用(从一个自动生成的文件,这就是为什么-std
出现了两次):
g++-4.8 -g -msse2 -m64 <defines> <warnings> -std=c++11 -fexceptions -std=c++11 <includes'-path> -c <source-file.cpp> -o <out-path>
产生以下错误:
<source-file, line>: error: ‘std::chrono::monotonic_clock’ has not been declared
我没能找到verymuch那并不是立即编译器版本或丢失-std=c++11
。从this推断,我不需要别的东西。
问题:怎么回事,我该如何解决?
从技术上讲,它的存在依赖于实现。例如,代码在MSVC中编译。谢谢。 – imallett 2014-11-24 19:41:19
@imallett该标准允许实现在命名空间'std'和嵌套命名空间中添加其他名称,所以在某些实现中可能会有'std :: chrono :: i_like_burritos'。但是并不要求C++ 11中名称空间'chrono'有一个名为'i_like_burritos'(或'monotonic_clock')的成员。 (或C++ 14,这是一个耻辱,因为我真的喜欢墨西哥卷饼。) – Casey 2014-11-24 19:44:53
当然。我只是说'std :: chrono :: monotonic_clock'是一个卷饼。 – imallett 2014-11-24 19:48:07