I'm trying to generate random numbers in my C++ program. It works on my laptop which runs windows. However, when I attempt to compile my program on another computer I get the following error messages:
error: ‘mt19937_64’ was not declared in this scope
error: expected ‘;’ before ‘randomGenerator’
corresponding the the following piece of code:
double** Euler::startSimulation(void) {
mt19937_64 randomGenerator (mySeed);
/* More unshown code below... */
}
I am compiling my code from command line using g++ with the -std=c++0x flag. How do I fix this problem so my code can compile and run properly on both computers.
mt19937(_64) are both calssified in namespace std.
To make them available, you need to tell the compiler, where to look for them. Use either
std::mt19937_64 RdmGeneratorObject(seed);
ore giveusing namespace std;
directive accordingly before opening the function declaration or main.