Question

I'm having trouble compiling this for android:

string buffer = readString(m_paths[SCREEN]);
if (buffer != "")
{
    //Read full buffer
    xml_document<> doc;
    doc.parse<0>((char*)buffer.c_str());
}

It works well on VS2010 but for some reason its failing in the ndk, it returns this error:

error:exception handling disabled, use -fexceptions to enable

I've searched and I found this: RapidXML compilation error parsing string

I've tried it but it also doesn't work.

Was it helpful?

Solution

The error tells you what to do: use -fexceptions to enable.

You would add that to your Android.mk, APP_CPPFLAGS += -fexceptions -frtti.

Also, your code is wrong. Change your code to doc.parse<0>(&buffer[0]);. c_str() returns a const char pointer which is non-modifiable, however parse modifies the contents so you need to pass the underlying buffer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top