gpt4 book ai didi

c++ - 如何在启用 C++11 的情况下在 xcode 4.6.2 中编译

转载 作者:行者123 更新时间:2023-11-28 03:15:50 24 4
gpt4 key购买 nike

我们有一个 .mm 文件包含 (一个 std header ),它报告以下错误:

In file included from 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/mutex:177:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1672:1: error: cannot declare a class template with no name
class __bind
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1742:35: error: expected expression
struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {};
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1742:36: error: '_Fp' does not refer to a value
struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {};
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1741:16: note: declared here
template<class _Fp, class ..._BoundArgs>
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1746:20: error: expected class name
: public __bind<_Fp, _BoundArgs...>
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1746:39: error: expected '{' after base class list
: public __bind<_Fp, _BoundArgs...>
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1746:39: error: expected ';' after class
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1746:39: error: expected unqualified-id
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1806:23: error: expected '>'
__bind<_Fp, _BoundArgs...>
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1806:26: error: expected unqualified-id
__bind<_Fp, _BoundArgs...>

命令行是

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang \
-x objective-c++ -arch armv7 -fmessage-length=0 -std=c++11 -stdlib=libc++ -fobjc-arc \
-Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers \
-Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties \
-Wno-receiver-is-weak -Wno-non-virtual-dtor -Wno-overloaded-virtual \
-Wno-exit-time-destructors -Wformat -Wno-missing-braces -Wparentheses \
-Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter \
-Wunused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized \
-Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion \
-Wno-constant-conversion -Wno-int-conversion -Wno-enum-conversion \
-Wno-shorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match \
-Wno-undeclared-selector -Wno-deprecated-implementations -Wno-c++11-extensions ...

有什么解决方法吗?

最佳答案

此类错误一般不是<functional>引起的,否则全世界都会报道他们。更有可能的原因是您的一个 header 做了一些不应该做的事情,这在以后引起了问题。例如。 #define __bind会产生这里看到的那种错误,显然是非法的。

关于c++ - 如何在启用 C++11 的情况下在 xcode 4.6.2 中编译 <functional>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16885235/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com