I need to compile some small cpp files so I'd like to do that through the terminal. I'm using Catalina 10.15.5. I found out that macOS has a built-in clang compiler and I can use commands like c++
or g++
. It's version:
Apple clang version 11.0.3 (clang-1103.0.32.29)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
But I need to know which c++ version it uses (e.g. c++17, c++11 or even less version). It's really important for my files.
I know I can specify the version like c++ --std=gnu++17
but the question is how to make the compiler to use it by default (without aliases, there must be a command to change it). Or at least how to find out which version does it use right now?
clang++ -Wall -std=c++17 foo.cpp -o foo
. For many .cpp files, a small makefile will be enough.