以下代码可以编译和运行,但VS2015 intellisense显示错误。 g ++& eclipse有同样的问题(编译和运行但显示错误)
有谁知道如何修复它?我尝试在谷歌搜索,但绝望。 错误有点烦人..: - )
#include <iostream>
#include <thread>
#include <chrono>
using namespace std;
using namespace std::literals;
using namespace chrono_literals;
int main()
{
this_thread::sleep_for(5s);
cout << "test \n";
return 0;
}
错误消息:“整数字面上的无效后缀's
非常感谢!
答案 0 :(得分:1)
您应该添加一些#include
语句和namespace
引用:
#include <iostream>
#include <chrono>
#include <thread>
int main()
{
using namespace std::literals::chrono_literals;
std::this_thread::sleep_for(5s);
std::cout << "test \n";
return 0;
}
在您的代码中,未告知编译器使用名称空间std
。没有std::literals