将-std = c ++ 11设置为mac终端的默认值 [英] Making -std=c++11 the default in mac terminal
本文介绍了将-std = c ++ 11设置为mac终端的默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我要编译时,我需要指定 -std = c ++ 11
:
When I want to compile, I need to specify -std=c++11
like this:
g++ -Wall -std=c++11 main.cpp -o main
我不知道是否有一个永久设置-std = c ++ 11标志的解决方案,所以它可以做:
and I wonder if there was a solution to set the -std=c++11 flag permanently so it will be possible to do:
g++ -Wall main.cpp -o main
p>
推荐答案
创建别名:别名g ++ ='g ++ -std = c ++ 11'
应该做的伎俩。
Create an alias: alias g++='g++ -std=c++11'
should do the trick.
(但是,OS X的GCC版本是如此古老,它不支持C ++ 11,你最好使用 clang
和 clang ++
。)
(However, the version of GCC that comes with OS X is so ancient that it doesn't support C++11, you'd be better off using clang
and clang++
.)
这篇关于将-std = c ++ 11设置为mac终端的默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文