As others have pointed out, you should use clang++ , not g++ . In addition, you should use the libC ++ library instead of the standard libstdC ++; The included version of libstdC ++ is quite old and therefore does not include the capabilities of the C ++ 11 library.
clang++ -std=c++11 -stdlib=libc++ -Weverything main.cpp
If you have not installed the command line tools for Xcode, you can start the compiler and other tools without doing this using the xcrun tool.
xcrun clang++ -std=c++11 -stdlib=libc++ -Weverything main.cpp
Also, if there is a special warning that you want to disable, you can pass additional compilers for this. At the end of the warning messages, the most specific flag that will include the warning is displayed. To disable this warning, you add no- to the warning name.
For example, you probably do not need C ++ 98 compatibility warnings. At the end of these warnings, it displays the -Wc++98-compat and disables them, you pass -Wno-c++98-compat .
bames53 Jan 09 '13 at 5:52 2013-01-09 05:52
source share