【问题标题】:How do i enable 'std=c++0x' from command line?如何从命令行启用“std=c++0x”?
【发布时间】:2014-04-05 06:56:42
【问题描述】:

我试图根据离散分布生成随机数并找到此链接:

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 执行此操作?

【问题讨论】:

    标签: c++ eclipse cmd


    【解决方案1】:

    像这样:

    g++ -std=c++0x random.cpp -o random.exe
    

    不管怎样,你的编译器已经过时了。您最好更新到现代版本。

    【讨论】:

      猜你喜欢
      • 2014-07-06
      • 2016-02-10
      • 1970-01-01
      • 2015-09-15
      • 1970-01-01
      • 2015-01-29
      • 1970-01-01
      • 2015-01-05
      • 1970-01-01
      相关资源
      最近更新 更多