0

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.

Community
  • 1
  • 1
Netwave
  • 23,907
  • 4
  • 31
  • 58

1 Answers1

1

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.

Jesse Good
  • 46,179
  • 14
  • 109
  • 158
  • not working...it continues to return that error, thanks anyway :) – Netwave Sep 13 '13 at 09:42
  • @DanielSanchez: I've updated my answer. You have two problems: 1) You don't have exceptions enabled, and 2) Your code is trying to modify read-only memory. – Jesse Good Sep 13 '13 at 09:58
  • Compiled!!! Thanks, it was the flag.... you saved my day, anytime you came to Madrid...send me a message, you have free Beer :) – Netwave Sep 13 '13 at 10:46