包含<chrono>时出错

error when including <chrono>

本文关键字:出错 gt chrono 包含 lt      更新时间:2023-10-16

我已经尝试包含该类来衡量代码段运行所需的时间。这些是我的包:

#include <iostream>
#include <fstream>
#include <math.h>
#include <chrono>
using namespace std;
using namespace std::chrono;

我的错误信息是:

FILENAME.cpp:4: chrono: No such file or directory

我的代码出了什么问题?

根据我的评论:您使用的是C++11编译器吗?对于g++,试着给它"-std=c++11"。

g++ -std=c++11 myfile.cpp

叮当声可能是一样的。