gpt4 book ai didi

c++ - 如何从命令行启用 'std=c++0x'?

转载 作者:太空狗 更新时间:2023-10-29 21:21:16 26 4
gpt4 key购买 nike

我试图生成遵循离散分布的随机数并找到了这个链接:

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

就其值(value)而言,您的编译器已经过时了。你最好更新到现代版本。

关于c++ - 如何从命令行启用 'std=c++0x'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22877664/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com