当前位置: 代码迷 >> Android >> android-ndk-r8b编译c++代码报错,该如何处理
  详细解决方案

android-ndk-r8b编译c++代码报错,该如何处理

热度:58   发布时间:2016-05-01 15:10:15.0
android-ndk-r8b编译c++代码报错
ndk-build对整个工程编译,报错如下:
Assembly code
"Compile++ thumb : hello-jni <= hello-jni.cppIn file included from D:/CD/workplace/HelloJNI//jni/hello-jni.cpp:18:0:D:/android-ndk-r8b/platforms/android-3/arch-arm/usr/include/jni.h:592:13: note:the mangling of 'va_list' has changed in GCC 4.4StaticLibrary  : libstdc++.aSharedLibrary  : libhello-jni.soInstall        : libhello-jni.so => libs/armeabi/libhello-jni.so

.so文件可以生成,不过android程序执行报错退出。

Android.mk 如下:
C/C++ code
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE    := hello-jniLOCAL_SRC_FILES := hello-jni.cppinclude $(BUILD_SHARED_LIBRARY)


这个测试程序并没有引用特定的库,所以可以把cpp改成c,再次编译运行无错。
求助这是怎么回事啊?
D:/android-ndk-r8b/platforms/android-3/arch-arm/usr/include/jni.h:592:13: note:
the mangling of 'va_list' has changed in GCC 4.4


------解决方案--------------------
I think that the warning is accurate; the mangling of va_list has indeed changed on ARM in GCC 4.4 in order to conform to the ARM ABI specifications. There is an option to turn off warnings about PSABI issues; -Wno-psabi. I think that option (if not some stronger option) should be used.
------解决方案--------------------
在Application.mk文件里加一句 NDK_TOOLCHAIN_VERSION=4.4.3
  相关解决方案