OpenSourceEcon / BootCamp2019

Repository of syllabi, lecture notes, Jupyter notebooks, code, and problem sets for OSE Lab Boot Camp 2019
85 stars 99 forks source link

Draw random numbers in C++ #31

Open tpellet opened 4 years ago

tpellet commented 4 years ago

I am having troubles using the "random" package in C++ to draw random numbers (for Monte Carlo). I get the following error message:

"error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options."

and "error: 'default_random_engine' is not a member of 'std'"

ozaltun commented 4 years ago

I think you need to add a new parameter when compiling, try:

g++ -std=c++11 -o

tpellet commented 4 years ago

Thank you, It works now!