views:

834

answers:

2

When i mix .m and .cpp i have a problem with xcode not finding the default cpp include (like <map>)

update: i'm adding a static lib in my iphone project (which does compile without any problems) and then use the include inside the .m, then the dependencies .h from c++ gets crazy..can't find or can't compile, i tried the .mm but it does'nt works.

+3  A: 

If you are using Objective-C++ (i.e. mixing Objective-C and C++ in one source file or importing a C++ header into an Objective-C file), then you should be using the .mm extension on your source code files. By default, Xcode will compile .mm files using the Objective-C++ compiler. .m files are compiled using the standard C compiler.

Barry Wark
A: 

The best way to diagnose this is to drag the "Compiling foo.mm" line from your Build Results window into a reply to this message. That shows us what your project is telling the compiler, in excruciating detail, and will show exactly what's wrong.

cdespinosa
Line Location c++config.h:153: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
CiNN
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/include/libkern/OSByteOrder.h:92: error: 'uint16_t' does not name a type
CiNN
Please provide the line that starts with "Compiling" so we can see the *input*, not just the *output*.
cdespinosa