[cfe-users] Enable C++11 flag by default in clang?

Matthias Maier tamiko+LLVM at kyomu.43-1.org
Thu Jul 10 23:45:46 PDT 2014

Am 11. Jul 2014, 03:49 schrieb Miguel Carvajal <krvajal.miguelangel at gmail.com>:

> 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)


More information about the cfe-users mailing list