加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

qt – 错误:未在此范围内声明’random_device’

发布时间:2020-12-16 09:50:35 所属栏目:百科 来源:网络整理
导读:我试着解决这个问题: c++0x_warning.h:32: Fehler:#error This file requires compiler and library support for the upcoming ISO C++ standard,C++0x. This support is currently experimental,and must be enabled with the -std=c++0x or -std=gnu++0x
我试着解决这个问题:

c++0x_warning.h:32: Fehler:#error This file requires compiler and
library support for the upcoming ISO C++ standard,C++0x. This support
is currently experimental,and must be enabled with the -std=c++0x or
-std=gnu++0x compiler options.

通过增加

QMAKE_CXXFLAGS += -std=c++0x

到我的.pro文件.

现在我收到这个错误:

error: ‘random_device’ was not declared in this scope
random_device rd;
^

解决方法

确保包含标题:

#include <random>

并且您可能需要在random_device之前添加std ::,除非您已使用“std”将“std”映射到您的命名空间中

using namespace std;

注意:通常最好显式指定std ::而不是将名称空间映射到默认名称空间.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读