I'm trying to include some C++11 headers in an iOS project, but Xcode / Clang can't find them. I'm trying to include <memory>
, <functional>
and a few others. But it complains that it can't find them during the build (despite me right-clicking and "Jumping to definition" which loads the file…). How do I get my project to use C++11 header files?
Lexical or Preprocessor Issue 'memory' file not found
Lexical or Preprocessor Issue 'functional' file not found
My project settings are:
C++ Language Dialect = C++11 [-std=c++11]
C++ Standard Library = libc++ (LLVM C++ standard library with C++11 support)
The files which try to include the headers are .h
for a templated class and a .h
that is included from a .mm
implementation.
Best Answer
It turned out that Clang's error message was unhelpful: the root include for these files was a
.m
file, compiling as Objective-C, so I renamed it to.mm
, to compile as Objective-C++, and it started working.