Click here to Skip to main content
15,883,905 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
C++
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <random>

int main ( int argc , char ** argv ) {

  std::random_device rd;
  std::mt19937_64 gen(rd());

 std::uniform_real_distribution<> dis(0, 1);

 std::cout << dis(gen) << std::endl;

  return 0;
}


I am using the random library in c++ on linux, but this compiler options
"g++ code.cpp -o code.exe -std=c++0x"
doesn't work because of the generator of random variables "mt19937_64"

this is the error:
erreur: ‘mt19937_64’ is not a member of ‘std’
Posted
Updated 9-Sep-13 4:44am
v3
Comments
Sergey Alexandrovich Kryukov 9-Sep-13 9:59am    
Not a question. Not clear. Incomplete. Not clear at all. Please click on Improve question above and clarify.
—SA
Richard MacCutchan 9-Sep-13 10:17am    
This class is only available with C++11. You need to get a copy of the latest compiler.
Member 10258053 9-Sep-13 10:25am    
Ok Thank you.
Sergey Alexandrovich Kryukov 9-Sep-13 17:22pm    
Right. Just a note: C++0x is an obsolete name for what is now called C++11.
—SA
Richard MacCutchan 10-Sep-13 2:59am    
And what did I call it in my reply?

1 solution

it compiles without problems when I use the version compiler gcc/4.7.2

Thank you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900