Enable C++11 flag by default in clang?

Hi, i’m trying to compile clang but before continue i want to know if there is a way to turn on c++11 mode by default in the compiler.

I mean, turn the switch on so i don’t have to type clang++ -std=c+11 every time/

Unfortunately, clang doesn't support a spec-file mechanism like gcc
yet (at least it didn't when I checked). So the easiest way to achieve
this is to use the alias mechanism of your shell:

Depending on your shell add a line

  alias clang++="clang++ -std=c++11"

to ~/.bashrc (in case of bash) or ~/.zshrc (if it is zsh) or something

(And source it via $ source ~/.[...], or open a new terminal)


Hi Matthias,

Given the fact that compiler and compile flags are usually easily
(permanently) adjustable in a Makefile there is not much point in doing

I assumed that the original question was about an easy way for a default
parameter on the command line.