1 year ago

#352113

test-img

Piffle Chur

Default C++ standard is c++98 in Apple Clang++ 13

I am new to macOS. I have a m1 Macbook ruing macOS Monterey. I am compiling and running c++ code in terminal.

The clang++ version is:

clang++ --version                                                                                                                
Apple clang version 13.1.6 (clang-1316.0.21.2)
Target: arm64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

when I compile any file without specifying -std=c++xx, clang++ will use c++98 as default. However, I checked the manual using man clang++, where it says "The default C++ language standard is gnu++14."

I wonder is there a way to set the default c++ standard as c++14 instead of c++98 (I don't want to use alias).

ps. I checked a lot posts, and they just confuse me more. Some people say that the apple clang just use c++98 as default, some say it is not.

Thanks a lot.

c++

macos

clang++

0 Answers

Your Answer

Accepted video resources