std::strtoull not recognized under my JNI NDK environment

十年热恋 提交于 2020-01-05 12:30:20

问题


i use some c++ code under android project by using JNI.

But always it give an alert saying that :

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

but however if i include the stdlib.h, it still have the error toast. My android.mk file content is like this:

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)

And my Application.mk is like this:

# 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

whenever i change the APP_STL flag to stlport_static, stlport_shared, gnustl_shared.

it still have the error toast,

Any have similar problem?

one thing more, my ndk version is android-ndk-r9


回答1:


Are you including <cstdlib>? The header <cstdlib> should declare std::strtoull, while <stdlib.h> should declare strtoull without the std::.



来源:https://stackoverflow.com/questions/20519115/stdstrtoull-not-recognized-under-my-jni-ndk-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!