我试图在离散分布后生成随机数并找到此链接:
http://www.cplusplus.com/reference/random/discrete_distribution/
我编译了他们给出的例子并得到了这个错误
C:\Users\Anand\Desktop>g++ random.cpp -o rand
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/random:3
5:0,
from random.cpp:3:
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/c++0x_warning.h:32:2: err
or: #error This file requires compiler and library support for the upcoming ISO
C++ standard, C++0x. This support is currently experimental, and must be enabled
with the -std=c++0x or -std=gnu++0x compiler options.
random.cpp: In function 'int main()':
这告诉我需要启用' -std = c ++ 0x'。这可以在IDE中轻松完成,但我如何通过cmd完成此操作?
答案 0 :(得分:3)
像这样:
g++ -std=c++0x random.cpp -o random.exe
对于它的价值,你的编译器已经过时了。你最好更新到现代版本。