我已经下载了 Android 2.3.6 源代码并成功构建了它。然后,我将一个 C++ 库添加到外部文件夹中,并尝试构建它,但是当我这样做时,我收到了以下错误:
prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: path/to/myfile.cpp:26: error: undefined reference to '__cxa_end_cleanup'
prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: : error: undefined reference to '__gxx_personality_v0'
in function path/to/myfile.cpp:26: error: undefined reference to 'operator delete(void*)'
我将此行添加到 Android.mk 文件中:LOCAL_CXX=path/to/g++compiler 为了使用g++编译器 但它仍然使用 .../arm-eabi/bin/ld 与其他库链接我如何强制使用 g++ 作为链接器。
最佳答案
您需要使用 g++
而不是 gcc
来编译和链接 C++ 代码。
关于android - 由于 undefined reference ,AOSP 构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15478396/