Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android NDK in Eclipse Type size_t could not be resolved

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...

like image 213
ademar111190 Avatar asked Apr 29 '13 16:04

ademar111190


Video Answer


1 Answers

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.

like image 66
amirkavyan Avatar answered Oct 05 '22 07:10

amirkavyan