2016-06-01 9 views
0

현재 opendir()과 같은 dirent.h 함수를 컴파일 할 수 없습니다. 내가 무슨 짓을 한? 나는이 일을했다고 확신한다.Android dirent.h opendir()이 컴파일되지 않습니다

Android_Utils.cpp :

#include <dirent.h> 

void Test1237(void) 
{ 
    struct DIR *dir = opendir("blah"); 
} 

내 Android.mk 파일 :

LOCAL_PATH := $(call my-dir) 

include $(CLEAR_VARS) 
LOCAL_MODULE := SDL2-prebuilt 
LOCAL_SRC_FILES := /work/SDL2/lib-android/$(TARGET_ARCH_ABI)/libSDL2.so 
include $(PREBUILT_SHARED_LIBRARY) 

# -------------------------------------------------------------------------------------------------- 

JNI_LIBPATH := /work/TT/android-TT/jniLibs 

include $(CLEAR_VARS) 
LOCAL_MODULE := libfreetype2 
LOCAL_SRC_FILES := /work/FreeType2/Android/$(TARGET_ARCH_ABI)/libfreetype2-static.a 
include $(PREBUILT_STATIC_LIBRARY) 


# -------------------------------------------------------------------------------------------------- 

include $(CLEAR_VARS) 

LOCAL_MODULE := main 

SDL_PATH := /work/SDL2-2.0.4 
GLM_PATH := /work/glm 
GLM_NDK_PATH1 := /Android/android-ndk-r9d/platforms/android-14/arch-arm/usr/include 
GLM_NDK_PATH2 := /Android/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.4.3/include 
GLM_NDK_PATH3 := /Android/android-ndk-r9d/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include 

TT_PATH := /work/TT 
TT_INCLUDES := $(TT_PATH) 

LOCAL_C_INCLUDES := $(TT_INCLUDES) $(SDL_PATH)/include $(GLM_NDK_PATH1) $(GLM_NDK_PATH2) $(GLM_NDK_PATH3) $(GLM_PATH) $(FT2_INCLUDES) 

MY_CFLAGS  := -DANDROID_PDS -mfloat-abi=softfp -mfpu=neon 

ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI), armeabi-v7a x86)) 
    LOCAL_CFLAGS := -DHAVE_NEON=1 $(MY_CFLAGS) -Wno-write-strings -Wno-trigraphs 
    LOCAL_CPPFLAGS := -Wno-conversion-null -fno-permissive 
    LOCAL_ARM_MODE := arm 
    LOCAL_ARM_NEON := true 
endif 

LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c \ 
    $(TT_PATH)/Android_Utils.cpp \ 
    $(TT_PATH)/main.cpp 

LOCAL_SHARED_LIBRARIES := SDL2-prebuilt 
LOCAL_STATIC_LIBRARIES := libfreetype2 

LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog -lm 

include $(BUILD_SHARED_LIBRARY) 

출력 :

SparkbookPro:jni admin$ ndk-build 
[armeabi-v7a] Install  : libSDL2.so => libs/armeabi-v7a/libSDL2.so 
[armeabi-v7a] Compile arm : main <= SDL_android_main.c 
[armeabi-v7a] Compile++ arm : main <= Android_Utils.cpp 
/work/TT/Android_Utils.cpp: In function 'void Test1237()': 
/work/TT/Android_Utils.cpp:12:39: error: 'opendir' was not declared in this scope 

답변

0

아하! dirent.h의 로컬 복사본을 내 포함 경로에 포함 시켜서 표준 경로를 포함시키지 않았습니다.