


xcrun clang++ -std=c++11 -stdlib=libc++ -Weverything main.cppĪlso if there's a particular warning you want to disable you can pass additional flags to the compiler to do so.

If you haven't installed the command line tools for Xcode you can run the compiler and other tools without doing that by using the xcrun tool. clang++ -std=c++11 -stdlib=libc++ -Weverything main.cpp Also, you should use the libc++ library instead of the default libstdc++ The included version of libstdc++ is quite old and therefore does not include C++11 library features. How to compile C++ with C++11 support in Mac TerminalĪs others have pointed out you should use clang++ rather than g++.
