Eclipse类型size_t中的Android NDK无法解决。

时间:2022-06-27 16:05:09

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

我得到了下面的错误:在android ndk项目上,“Type”size_t“无法解决”,但我已经添加了库路径:

/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 个解决方案

#1


17  

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.

size_t在stddef中定义。h是特定于编译器的。为了将其添加到include路径中,您必须添加/toolchain// prebuild /// //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.

例如,在使用ndk的64位windows机器上构建一个android应用程序,您必须添加< ndk - path >\工具链\arm-linux-androideabi-4.8\prebuilt\windows-x86_64\lib\ arm-linux-androideabi\4.8\包括到您的路径。

#1


17  

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.

size_t在stddef中定义。h是特定于编译器的。为了将其添加到include路径中,您必须添加/toolchain// prebuild /// //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.

例如,在使用ndk的64位windows机器上构建一个android应用程序,您必须添加< ndk - path >\工具链\arm-linux-androideabi-4.8\prebuilt\windows-x86_64\lib\ arm-linux-androideabi\4.8\包括到您的路径。