Search code examples
androidc++xml-parsingcocos2d-x

cocos2d-x use pugixml to parse xml on android ERROR 'void* pugi::impl::(anonymous namespace)::xpath_allocator::allocate(size_t)'


I use pugixml parse xml, it's work fine on ios. However, when I change to android, use './build_native.sh' (cocos2d-x for android) to build my project. There are some error:

pugi/pugixml.cpp: In member function 'void* pugi::impl::(anonymous namespace)::xpath_allocator::allocate(size_t)'
pugi/pugixml.cpp:5722:26: error: exception handling disabled, use -fexceptions to enable

someone can help me. thank you very much!


Solution

  • You have two options:

    1. Enable exception handling using -fexceptions, if your platform supports it
    2. Disable exception handling in pugixml by adding #define PUGIXML_NO_EXCEPTIONS to pugiconfig.hpp or to your build settings.