Android NDK in Eclipse Type size_t could not be resolved

匿名 (未验证) 提交于 2019-12-03 02:52:02

问题:

I'm getting the follow error: "Type 'size_t' could not be resolved" on android ndk project, but I already added the library paths:

/Users/ademar/android-ndk-r8e/platforms/android-8/arch-arm/usr/include /Users/ademar/android-ndk-r8e/sources/cxx-stl/stlport/stlport /Users/ademar/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.7/include 

so i not understand why this error.


code where I get the error:

static inline bool simplejson_wcsnlen(const wchar_t *s, size_t n) 

I added each one of headers described here but still not working.


I Tried the follow:

#include <string.h> #include <jni.h> #include <android/log.h> #include <iostream> #include <stdio.h>  extern "C" {     JNIEXPORT jstring JNICALL Java_xxx_getStringFromJNI(JNIEnv* env, jobject thiz, jstring param) {         size_t x;         return env->NewStringUTF("test");     } } 

and it also not work...

回答1:

size_t is defined in stddef.h which is compiler specific. In order to add it to the include path you have to add the /toolchain//prebuilt//lib/gcc///include to your path.

For example for building an android app on 64bit windows machine using ndk, you have to add <NDK-PATH>\toolchains\arm-linux-androideabi-4.8\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.8\include to your path.



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