So I want to publicly expose a Box2D (C++) pointer to other Objective-C++ classes in my cocos2d + box2d project. I declare a method "getWorld" in my interface which references C++ class b2World and imports Box2D.h. All the files in my project are .mm extension, and I get the following compile error:
In file included from DebugDrawLayer.mm:2:
In file included from World.h:10:
In file included from external/Box2d/Box2D/Box2D.h:34:
external/Box2d/Box2D/Common/b2Settings.h:22:10: fatal error: 'cassert' file not found
#include <cassert>
I guess Box2D.h is somehow compiled as C instead of C++, but I fail to understand how this happens. According to the log the include chain clearly starts from a .mm file.
Update:
The log says for World.mm (compiled earlier) that it clearly compiles as objective-c++
CompileC Objects-normal/i386/World.o World.mm normal i386 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
but for DebugDrawLayer.mm it says objective-c
CompileC Objects-normal/i386/DebugDrawLayer.o DebugDrawLayer.mm normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
Both files are set as default - Objective-C++ source. What gives..?