On Linux: In general, all commonly available linux distributions will use libstdc++ by default, and all modern versions of GCC come with a libstdc++ that supports C++11. If you want to compile c++11 code here, use one of:
g++ -std=c++11 input.cxx -o a.out
(usually GNU compiler)
g++ -std=gnu++11 input.cxx -o a.out
On OS X before Mavericks: g++
was actually an alias for clang++
and Apple's old version of libstdc++ was the default. You could use libc++ (which included c++11 library support) by passing -stdlib=libc++
. If you want to compile c++11 code here, use one of:
g++ -std=c++11 -stdlib=libc++ input.cxx -o a.out
(clang, not GNU compiler!)
g++ -std=gnu++11 -stdlib=libc++ input.cxx -o a.out
(clang, not GNU compiler!)
clang++ -std=c++11 -stdlib=libc++ input.cxx -o a.out
clang++ -std=gnu++11 -stdlib=libc++ input.cxx -o a.out
On OS X since Mavericks: libc++ is the default. You can use Apple's old version of libstdc++ (which does not include c++11 library support) by passing -stdlib=libstdc++
clang++ -std=c++11 input.cxx -o a.out
clang++ -std=gnu++11 input.cxx -o a.out
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…