Xcode cannot find standard C ++ include file

When I mix .m and .cpp, I have a problem with xcode, without showing that the default cpp includes (for example <map>)

update: I add a static lib in my iphone project (which compiles without any problems), and then use include inside .m, then .h dependencies on C ++ become crazy .. cannot find or not compile, I tried. mm, but it does not work.

+3
source share
2 answers

If you use Objective-C ++ (i.e. mixing Objective-C and C ++ in the same source file or importing the C ++ header into an Objective-C file), you should use the extension .mmin your source code files. By default, Xcode will compile files .mmusing the Objective-C ++ compiler. .mfiles compiled using the standard C compiler.

+6
source

The best way to diagnose this is to drag the line “Compiling foo.mm” from the “Assembly Results” window in response to this message. This shows us what your project tells the compiler, in painful detail, and shows what exactly is wrong.

0
source

Source: https://habr.com/ru/post/1710695/


All Articles