No member named 'forward' in namespace 

2020-02-14 03:19发布

问题:

In XCode, I recently made and tested a processing library that uses boost. I just set up a basic project in the IDE, coded away, and it builds fine.

I now want to use that library in another application. The other application's xcode project was automatically made using a 3rd party tool. When I try to include my boost-based library in this other application, I get errors stating . . .

No member named 'forward' in namespace 'std'

and also, the line . .

#include <tuple>

gives the preprocessor error

'tuple' file not found

Seeing as the original library builds just fine on my machine, the errors must be down to a difference in the build settings, but I cannot see the difference and do not know of a good way to compare the build settings of 2 different projects. Can anyone suggest the build setting that might be causing me the problem??

EDIT:

In both projects, the setting for

  • Compiler for C/C++/Objective-C = Apple LLVM Compiler 3.0

  • C++ Language dialect = Compiler default

  • C++ Standard Library = Compiler default

EDIT 2 [solved]:

  • I still had C++11 dialect enabled in the Target settings. DoH!

回答1:

Your project compiles as C++11 and is using a C++11 standard library (std::forward and the header are new). The original project appears to compile as C++03 with a C++03 standard library, so those new features are not available.