std :: strtoull在我的JNI NDK环境下无法识别

时间:2013-12-11 12:26:10

标签: java android c++ android-ndk

我使用JNI在android项目下使用一些c ++代码。

但它始终会发出警告说:

jni/sample.cpp: In function 'int Java_com_android_mymapsforge_create(JNIEnv*, jo
bject)':
jni/sample.cpp:78:14: error: 'strtoull' is not a member of 'std'
jni/sample.cpp:78:14: note: suggested alternative:
C:/TDDOWNLOAD/adt-bundle-windows-x86_64-20130729/ndk/android-ndk-r9/platforms/an
droid-14/arch-arm/usr/include/stdlib.h:66:27: note:   'strtoull'
make: *** [obj/local/armeabi/objs/ann/sample.o] Error 1

但是如果我包含stdlib.h,它仍然有错误吐司。我的android.mk文件内容是这样的:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../ 

LOCAL_MODULE    := libann
LOCAL_LDLIBS    := -llog

NDK_TOOLCHAIN_VERSION := clang
LOCAL_CPPFLAGS += -std=c++11

LOCAL_SRC_FILES := \
    ANN.cpp \
    bd_pr_search.cpp \
    bd_tree.cpp \
    kd_pr_search.cpp \
    kd_split.cpp \
    kd_util.cpp \
    bd_fix_rad_search.cpp \
    bd_search.cpp \
    brute.cpp \
    kd_fix_rad_search.cpp \
    kd_search.cpp \
    kd_tree.cpp \
    kd_dump.cpp \
    perf.cpp\
    sample.cpp

include $(BUILD_SHARED_LIBRARY)

我的Application.mk是这样的:

# The ARMv7 is significanly faster due to the use of the hardware FPU
APP_ABI := armeabi armeabi-v7a
#APP_ABI := armeabi
APP_OPTIM := release
#APP_OPTIM := debug
#APP_STL := stlport_static
APP_STL := gnustl_static

每当我将APP_STL标志更改为stlport_static,stlport_shared,gnustl_shared。

它仍然有错误的吐司,

有没有类似的问题?

还有一件事,我的ndk版本是 android-ndk-r9

1 个答案:

答案 0 :(得分:2)

您是否包括<cstdlib>?标题<cstdlib>应声明std::strtoull,而<stdlib.h>应声明strtoull而不std::