Std random functions not working - Qt MinGw
I am using QtCreator 2.4.1, with QtSdk 4.8.1 and MinGw 4.7.2
I'm trying to use a (C ++ 11) random library, but I have been unsuccessful so far. Take the following code example:
#include <random>
...
std::default_random_engine generator;
std::uniform_int_distribution<int> distribution(1,6);
int dice_roll = distribution(generator); // generates number in the range 1..6
The compiler complains:
error: 'default_random_engine' is not a member of 'std'
error: 'uniform_int_distribution' is not a member of 'std'
I have the -std = c ++ 0x flag in my .pro file. All other STL functions work fine, so I am puzzled! I would appreciate it if someone could help me.
source to share
Well, stupid problem, but it can happen to others, so we go:
For some reason, my code compiled with MinGW 4.4, the default version that comes with my Qt Creator. To bring it back to MinGw 4.7.2, which I already installed on my computer, I clicked the Projects tab to the left of the QCreator screen, then selected the correct toolchain.
Thanks download Joachim Pileborg for pointing me in the right direction.
source to share