下面的代码可以编译和运行,但是VS2015智能感知显示错误。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;
}错误消息:“整数文字上的”后缀“无效”
非常感谢!
发布于 2015-10-03 22:06:02
您应该添加一些#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,5s就不能工作。
https://stackoverflow.com/questions/32927393
复制相似问题