Jere
Jere

Reputation: 1266

Change clang default c++-version (mode)

I want to regularly compile C++20 code, using clang.

In the clang command guide (https://clang.llvm.org/docs/CommandGuide/clang.html) it says that I can add a flag (in my case: -std=c++2a) every time I want to compile something.

In the clang user manual (https://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes) it states:

If no -std option is specified, clang defaults to gnu17 mode. Many C99 and C11 features are supported in earlier modes as a conforming extension, with a warning.

But is there a way to permanently change the default mode (i.e. c++-version) that clang uses?

Upvotes: 3

Views: 3111

Answers (1)

Rishabh Deep Singh
Rishabh Deep Singh

Reputation: 914

you can use an alias to do that although I won't recommend that.

alias g++='g++ -std=c++20'

Upvotes: 2

Related Questions