如何从命令行启用'std = c ++ 0x'? [英] How do i enable 'std=c++0x' from command line?

查看:178
本文介绍了如何从命令行启用'std = c ++ 0x'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在离散分布后产生随机数,并找到以下链接:

I was trying to generate random numbers following a discrete distribution and found this link:

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?

This tells that i need to enable '-std=c++0x'. This can be done easily in an IDE but how do i do this via cmd?

推荐答案

像这样:

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

是值得的,你的编译器是相当过时的。你会更好地更新到现代版本。

For what it is worth, your compiler is quite out of date. You would do well to update to a modern version.

这篇关于如何从命令行启用'std = c ++ 0x'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆