我正在尝试编译Here中找到的Doom代码。但是,当我运行ndk-build时,我看到以下内容...

jni/droid/i_video.c:45:17: fatal error: SDL.h: No such file or directory


但...

find ./ -name SDL.h
.//SDL-1.2.13/include/SDL.h


我的Android.mk显示...

DOOM := apps/Doom/project/jni
INC             := -I$(DOOM) -I$(DOOM)/include -I$(DOOM)/SDL-1.2.13/include
LOCAL_CFLAGS    := $(DOOM_FLAGS) $(OPTS) $(INC)


有人能看到我在做什么吗?

最佳答案

我相信您想将所有包含项放在LOCAL_C_INCLUDES变量而不是INC变量中,因为android-ndk构建系统未使用INC

这会将您的行更改为(请注意已删除的-I

LOCAL_C_INCLUDES := $(DOOM) $(DOOM)/include $(DOOM)/SDL-1.2.13/include


下面引用了LOCAL_C_INCLUDES的相关部分

LOCAL_C_INCLUDES
    An optional list of paths, relative to the NDK *root* directory,
    which will be appended to the include search path when compiling
    all sources (C, C++ and Assembly). For example:

        LOCAL_C_INCLUDES := sources/foo

    Or even:

        LOCAL_C_INCLUDES := $(LOCAL_PATH)/../foo

    These are placed before any corresponding inclusion flag in
    LOCAL_CFLAGS / LOCAL_CPPFLAGS

    The LOCAL_C_INCLUDES path are also used automatically when
    launching native debugging with ndk-gdb.

07-27 19:39