gpt4 book ai didi

qt - 错误 : 'random_device' was not declared in this scope

转载 作者:行者123 更新时间:2023-12-04 19:49:24 30 4
gpt4 key购买 nike

我试着解决这个问题:

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; ^

enter image description here

最佳答案

确保包含 header :

#include <random>

并且您可能需要在 random_device 前面添加 std::,除非您使用

将“std”映射到您的命名空间
using namespace std;

注意:与将命名空间映射到默认命名空间相比,显式指定 std::通常更可取。

关于qt - 错误 : 'random_device' was not declared in this scope,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21798491/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com