Pergunta

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.

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top