Hi,
When I try to compile a C++ code with try/catch statements, it can not pass build.
Does anyone know if try/catch is supported or not in android? Or how can I fix this issue?
test code:
#include <stdio.h>
int main()
{
try
{
printf("try statement\n");
throw 1;
}
catch (...)
{
printf("catch exeption here\n");
}
}
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_SRC_FILES := \
./test.cpp
LOCAL_CFLAGS += -fexceptions
LOCAL_LDFLAGS += -lstdc++
LOCAL_MODULE := test
include $(BUILD_EXECUTABLE)
compile error:
mydroid/try_catch/./test.cpp:9: undefined reference to `__cxa_allocate_exception'
wjjsun
2008/12/22