繁体   English   中英

为什么VS2015 intellisense在C ++ 11用户定义文字(UDL)上显示错误

[英]Why VS2015 intellisense shows error on C++11 user defined literals (UDL)

下面的代码可以编译并运行,但是VS2015 intellisense显示错误。 g ++和Eclipse具有相同的问题(已编译并运行,但显示错误)

有谁知道如何修理它? 我尝试在Google上搜索,但无望。 错误有点烦人.. :-)

#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'无效”

非常感谢!

您应该添加一些#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不能工作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM