Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: 'random_device' was not declared in this scope

I tried fixing this :

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.

by adding

QMAKE_CXXFLAGS += -std=c++0x

to my .pro file.

Now I'm getting this error:

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

enter image description here

like image 882
Sahil Sareen Avatar asked Jan 28 '26 11:01

Sahil Sareen


1 Answers

Make sure you include the header:

#include <random>

and you may need to add std:: in front of random_device, unless you have mapped 'std' into your namespace using

using namespace std;

Note: It is generally preferable to explicitly specify std:: as opposed to mapping namespaces into your default namespace.

like image 174
Steger Avatar answered Jan 31 '26 02:01

Steger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!