.mm c++ oc 混编

When you create a static library you don't link in the dependent libraries. As a result, when you rename one of the files from .m to .mm it starts to now depend on C++ features such as stack unwinding when receiving exceptions. Even if you tell the compiler that you have no intent of using exceptions (by the denial of C++ exceptions in the compile flags), it still needs to known the potential mechanism for stack unwinding (this is what the personality variable means).

The reason why the template apps from Cocos2d+Box2d don't have this problem is that they possess some .mm files; as a result the c++ compiler is used to perform the final link, which pulls in the c++ library automatically.

 

https://stackoverflow.com/questions/18804414/xcode-why-does-renaming-to-mm-fail-with-undefined-symbol-gxx-personality-s

posted @ 2017-12-07 15:13  zzfx  阅读(390)  评论(0编辑  收藏  举报