Android 용 ndk 예제 인 android-ndk-r6b/samples/hello-jni를 컴파일하려고하는데 행운이 없습니다.Android NDK 샘플 컴파일 오류 : string.h : 해당 파일이나 디렉토리가 없습니다.
내가지고있어 컴파일 오류는 다음과 같습니다
$:/media/rober/android/android-ndk-r6b/samples/hello-jni$ ndk-build
Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup : libs/armeabi/gdb.setup
Compile thumb : hello-jni <= hello-jni.c
/media/rober/android/android-ndk-r6b/samples/hello-jni/jni/hello-jni.c:17:20: error: string.h: No such file or directory
/media/rober/android/android-ndk-r6b/samples/hello-jni/jni/hello-jni.c:18:17: error: jni.h: No such file or directory
/media/rober/android/android-ndk-r6b/samples/hello-jni/jni/hello-jni.c:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Java_com_example_hellojni_HelloJni_stringFromJNI'
make: *** [/media/rober/android/android-ndk-r6b/samples/hello-jni/obj/local/armeabi/objs-debug/hello-jni/hello-jni.o] Error 1
환경 :
Ubuntu $:/media/rober/android/android-ndk-r6b/samples/hello-jni$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 11.10 Release: 11.10 Codename: oneiric Java $:/media/rober/android/android-ndk-r6b/samples/hello-jni$ java -version java version "1.6.0_22" Java(TM) SE Runtime Environment (build 1.6.0_22-b04) Java HotSpot(TM) Server VM (build 17.1-b03, mixed mode) Make $:/media/rober/android/android-ndk-r6b/samples/hello-jni$ make -v GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for i686-pc-linux-gnu AWK $:/media/rober/android/android-ndk-r6b/samples/hello-jni$ awk -W version mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan compiled limits: max NF 32767 sprintf buffer 1020 Android $:/media/rober/android/android-ndk-r6b/samples/hello-jni$ export | grep ANDROID declare -x ANDROID_HOME="/media/rober/android/android-sdk-linux_86" declare -x ANDROID_NDK="/media/rober/android/android-ndk-r6b/" declare -x ANDROID_NDK_ROOT="/media/rober/android/android-ndk-r6b/" declare -x ANDROID_SDK_HOME="/media/rober/android/android-sdk-linux_86" PATH (splitted by "\n" for easy reading) $:/media/rober/android/android-ndk-r6b/samples/hello-jni$ export | grep PATH | grep bin declare -x PATH=" /media/rober/dev/apache-ant-1.7.1/bin: /media/rober/dev/apache-maven-3.0.3/bin: /media/rober/android/android-sdk-linux_86/platform-tools: /media/rober/android/android-sdk-linux_86/tools: /media/rober/android/android-ndk-r6b/: /usr/lib/lightdm/lightdm: /usr/local/sbin: /usr/local/bin: /usr/sbin: /usr/bin: /sbin: /bin: /usr/games: /media/rober/dev/jdk1.6.0_22/bin: /media/rober/dev/apache-ant-1.7.1/bin: /media/rober/dev/apache-maven-3.0.3/bin: /media/rober/android/android-sdk-linux_86/platform-tools: /media/rober/android/android-sdk-linux_86/tools: /media/rober/android/android-ndk-r6b/
내가 환경 변수 또는 구성의 일종을 누락 느낌이 이는 ndk에게 같은 ndk 디렉토리 구조 안에있을 때조차도 string.h와 jni.h 파일을 찾을 곳을 알려주지 만 실제로 어떤 일이 벌어지는지는 모르겠습니다.
이 팁의 모든 종류의
헤더 파일은 NDK 디렉토리에 있지만 어떤 이유로 든 발견되지 않습니다.
$ find/media/rober/android/-name string.h /media/rober/android/android-ndk-r6b/소스/cxx-stl/stlport/stlport/string.h /media/rober/android/android-ndk-r6b/platforms/android-9/arch-x86/usr/include/asm/string.h /media/android-3/arch-x86/usr/include/string.h /media/rober/android/안드로이드 -ndk-r6b/플랫폼/안드로이드 -ndk-r6b/플랫폼 /usr/include/linux/string.h –
실제로 파일 이름은 string.h가 아닙니다. android-ndk-r8/sources/cxx-stl/gnu-libstdC++/include/string과 비슷한 위치에 있습니다. – Dror