如何解决Android NDK中的编译错误?

时间:2015-08-25 03:54:53

标签: android android-ndk

目录结构如下:

- test/
-- deps/
--- librtmp/
---- rtmp.h
---- Android.mk -> librtmp.a
--- .../  #other deps
-- Android.mk   -> test.a
-- src/
--- flv_muxer.c

flv_muxer.c代码段:

#include "librtmp/rtmp.h"

编译错误:

$ ndk-build
[armeabi-v7a] Compile thumb  : test <= flv_muxer.c
In file included from /Users/workdir/testproject/test/src/flv_muxer.c:9:0:
/Users/workdir/testproject/test/src/flv_muxer.h:13:26: fatal error: librtmp/rtmp.h: No such file or directory
 #include "librtmp/rtmp.h"
                          ^
compilation terminated.
make: ***  Error 1

1 个答案:

答案 0 :(得分:1)

我通过添加LOCAL_CFLAGSLOCAL_C_INCLUDES解决了编译错误,如下所示:

- Android.mk - &gt; test.a

LOCAL_CFLAGS := -I$(LOCAL_PATH)/deps/

LOCAL_C_INCLUDES :=                     \
    $(LOCAL_PATH)/deps/                 \
    $(LOCAL_PATH)/deps/librtmp