Android dirent.h opendir()将无法编译

时间:2016-06-01 01:59:58

标签: android android-ndk opendir dirent.h

我目前无法编译诸如opendir()之类的dirent.h函数。我做了什么?我确信我有这个工作。

Android_Utils.cpp:

TReturn : (Set → Set) → Set1
TReturn M = {A : Set} → A → M A

TBind : (Set → Set) → Set1
TBind M = {A B : Set} → M A → (A → M B) → M B

module Monad where
  record Monad (M : Set → Set) : Set1 where
    field
      return : TReturn M
      _⟫=_ : TBind M

我的Android.mk文件:

#include <dirent.h>

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

输出:

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)

1 个答案:

答案 0 :(得分:0)

啊哈!我的include路径中有一个dirent.h的本地副本,因此没有包含标准的副本。