我试图生成遵循离散分布的随机数,并找到了此链接:
http://www.cplusplus.com/reference/random/discrete_distribution/ 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 执行此操作?
像这样:
g++ -std=c++0x random.cpp -o random.exe
无论如何,您的编译器已经过时了。您最好更新到现代版本。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)