I have a objective c/c++ project under iOS, moving it from OS/X and I get a \'file not found\' error on
#include
It\'s a clean p
If you include a header in an ObjC file and it includes <string>
then you hit errors like this. For all .m files XCode uses a C compiler (clang or llvm-gcc). For all .mm files it will use (clang++ or llvm-g++).
I suggest going through and renaming all your .m files to .mm. Including main.m to main.mm.
Are you really sure <string>
is included only from a .cpp file?
I just tested on a fresh project, by adding a .cpp file and including <string>
, and it works, just as expected (same Xcode version, same SDK version).
But if I include <string>
in a .m file, then of course I got a «file not found» compiler error.
So double-check this, as the error may come from here.
Do you include <string>
from a .cpp file only, or from a .h file, intended to be used by a .cpp implementation?
Then maybe it's also included by a .m file, hence the error.
Also check your precompiled headers, if any, to see if you include some C++ stuff there...
Also remember, in that later case, that you can rely on the __cplusplus
macro, when needed.