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.
gcc - v
) Better use 'std=C++11', not '-std=c++0x'. -and- Try to add-m64
flag to GCC. -or- Check ifstd::mt19937
version works. -and- Try to resolve namespace explicitly:std::mt19937_64
instead of 'mt19937_64'.sudo yum install gcc-4.8.1 glibc* libstd*
). AFAIK, 4.8.1 is a first version which completely C++11 (and lastest stable for this moment). And +1 for using RedHat =)