Android:引用头文件的问题

时间:2013-05-09 14:11:59

标签: android c

我正在尝试编译找到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)

任何人都能看到我做错了什么?

1 个答案:

答案 0 :(得分:1)

我相信你想把所有的包含放在LOCAL_C_INCLUDES变量而不是INC变量中,因为INC未被android-ndk构建系统使用。

这会将您的行更改为(请注意已删除的-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.