0

< Functional > (標準ヘッダー) を含む .mm ファイルがあり、次のエラーが報告されます。

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 ...

回避策はありますか?

4

1 に答える 1

2

このようなエラーは通常、 によって引き起こされるもの<functional>ではありません。はるかに可能性の高い原因は、ヘッダーの 1 つがすべきでないことを行い、後で問題が発生したことです。たとえば#define __bind、まさにここで見られる種類のエラーが生成され、明らかに違法です。

于 2013-06-02T22:18:45.340 に答える