I'm a Mac OS X Lion user who uses Xcode for C++, and it appears that no updates are available for Xcode. I do not appear to be able to compile C++11-exclusive code, but for whatever reason, I thought Apple had gotten C++11 pretty much implemented. And yes, I do have support for Command Line Tools.
我是一个Mac OS X Lion用户,他使用Xcode为c++,而且似乎没有Xcode的更新。我似乎无法编译c++ 11的代码,但不管出于什么原因,我认为苹果已经实现了c++ 11的基本实现。是的,我确实支持命令行工具。
Then again, that might just be me. If so, is there any sort of IDE that supports C++11, or any way to upgrade?
再说一次,那可能就是我。如果是这样,是否有支持c++ 11的IDE,或者任何升级的方法?
3 个解决方案
#1
8
I use Xcode and set the following settings:
我使用Xcode设置如下设置:
C++ language dialect: C++11 or GNU++11
语言方言:c++ 11或GNU++11。
C++ Standart Library: libc++ (LLVM C++ standart library with C++11 support)
c++标准库:libc++ (LLVM c++标准库,c++ 11支持)
Xcode version: 4.3.2
Xcode版本:4.3.2
#2
3
If you're using Xcode 4.3 there are several relevant project settings you need to use C++11 features. The first is to use the clang compiler. Something like
如果您正在使用Xcode 4.3,那么您需要使用c++ 11特性的几个相关的项目设置。第一个是使用clang编译器。类似的
GCC_VERSION = com.apple.compilers.llvm.clang.1_0
in your .xcconfig
will set it, or you can use the GUI.
在您的.xcconfig中将设置它,或者您可以使用GUI。
Next, you need to tell LLVM which C++ standard to use:
接下来,您需要告诉LLVM使用哪个c++标准:
CLANG_CXX_LANGUAGE_STANDARD = gnu++11
This will make language features like range based for, delegated constructors, etc. available.
这将使语言特性如基于范围的、委托的构造函数等。
Finally, if you want to use C++11 STL features (such as std::unordered_map
) you need to use the libc++ STL:
最后,如果您想使用c++ 11 STL特性(比如std::unordered_map),您需要使用libc++ STL:
CLANG_CXX_LIBRARY = libc++
#3
0
On XCode 5 / opencv 2.4.9, I can select:
在XCode 5 / opencv 2.4.9中,我可以选择:
And it builds without error. If i set the libc++ without specifying C++ Language Dialect then I get same issue as OP
它毫无差错地构建。如果我在不指定c++语言的情况下设置了libc++,那么我将得到与OP相同的问题。
#1
8
I use Xcode and set the following settings:
我使用Xcode设置如下设置:
C++ language dialect: C++11 or GNU++11
语言方言:c++ 11或GNU++11。
C++ Standart Library: libc++ (LLVM C++ standart library with C++11 support)
c++标准库:libc++ (LLVM c++标准库,c++ 11支持)
Xcode version: 4.3.2
Xcode版本:4.3.2
#2
3
If you're using Xcode 4.3 there are several relevant project settings you need to use C++11 features. The first is to use the clang compiler. Something like
如果您正在使用Xcode 4.3,那么您需要使用c++ 11特性的几个相关的项目设置。第一个是使用clang编译器。类似的
GCC_VERSION = com.apple.compilers.llvm.clang.1_0
in your .xcconfig
will set it, or you can use the GUI.
在您的.xcconfig中将设置它,或者您可以使用GUI。
Next, you need to tell LLVM which C++ standard to use:
接下来,您需要告诉LLVM使用哪个c++标准:
CLANG_CXX_LANGUAGE_STANDARD = gnu++11
This will make language features like range based for, delegated constructors, etc. available.
这将使语言特性如基于范围的、委托的构造函数等。
Finally, if you want to use C++11 STL features (such as std::unordered_map
) you need to use the libc++ STL:
最后,如果您想使用c++ 11 STL特性(比如std::unordered_map),您需要使用libc++ STL:
CLANG_CXX_LIBRARY = libc++
#3
0
On XCode 5 / opencv 2.4.9, I can select:
在XCode 5 / opencv 2.4.9中,我可以选择:
And it builds without error. If i set the libc++ without specifying C++ Language Dialect then I get same issue as OP
它毫无差错地构建。如果我在不指定c++语言的情况下设置了libc++,那么我将得到与OP相同的问题。