Eclipse中的Android NDK类型size_t无法解析 [英] Android NDK in Eclipse Type size_t could not be resolved
问题描述
我收到以下错误:在android ndk项目中键入'size_t'无法解析,但我已经添加了库路径:
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.
得到错误:
static inline bool simplejson_wcsnlen(const wchar_t *s, size_t n)
我添加了每个描述的标题这里,但仍然不工作。
我试过了以下内容:
#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");
}
}
它也不工作...
推荐答案
size_t是在stddef.h中定义的,它是编译器特定的。为了将它添加到包含路径,你必须添加/ toolchain // prebuilt // lib / gcc /// include到你的路径。
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.
例如,在使用ndk的64位Windows机器上构建一个Android应用程序,您必须添加< NDK-PATH> \toolchains\arm-linux-androideabi-4.8\prebuilt\\ \\ windows-x86_64\lib\gcc\arm-linux-androideabi\4.8\include
到你的路径。
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.
这篇关于Eclipse中的Android NDK类型size_t无法解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!