我正在尝试编译NDK项目该项目包含用于音频压缩的OpenCoreAMR库。 jni文件夹的结构就像这样
/ JNI
/lib-flac
/libmp3lame
/liboggvorbis
/libopencoreamr <---- That where the compilation problem is occuring.
我在/ jni目录中运行ndk-build NDK_LOG=1
时会出现此错误。
C:/Users/ADMIN/Desktop/EnjoderJNI/app/src/main/jni/com_nll_nativelibs_VorbisEncoder.c:149:3: warning: format '%d' expects argument of type 'int', but argument 5 has type 'jlong' [-Wformat=]
[arm64-v8a] Compile++ : encoder <= com_nll_nativelibs_amr_wrapper.cpp
[arm64-v8a] Compile++ : encoder <= com_nll_nativelibs_amr_encoder.cpp
C:/Users/ADMIN/Desktop/EnjoderJNI/app/src/main/jni/libopencoreamr/com_nll_nativelibs_amr_encoder.cpp:4:47: fatal error: com_nll_nativelibs_amr_interf_enc.h: No such file or directory
#include <com_nll_nativelibs_amr_interf_enc.h>
^
compilation terminated.
make: *** [C:/Users/ADMIN/Desktop/EnjoderJNI/app/src/main/obj/local/arm64-v8a/objs/encoder/libopencoreamr/com_nll_nativelibs_amr_encoder.o] Error 1
我不知道为什么它会说 com_nll_nativelibs_amr_interf_enc.h 缺失,即使文件正好在目录中。
我在Windows 10上使用NDK r11C。
如何解决此问题?
/ jni文件夹中的Android.mk 。
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LAME_LIBMP3_DIR := libmp3lame
LIBVORBIS_LIBOGG_DIR := liboggvorbis
LIBFLAC_DIR := lib-flac
LIB_OPENCORE_AMR_DIR := libopencoreamr
LOCAL_MODULE := encoder
LIBFLAC_SRC_FILES := \
$(LIBFLAC_DIR)/ogg/src/bitwise.c \
$(LIBFLAC_DIR)/ogg/src/framing.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/bitmath.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/bitreader.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/cpu.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/crc.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/fixed.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/float.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/format.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/lpc.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/md5.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/memory.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/metadata_iterators.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/metadata_object.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/ogg_decoder_aspect.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/ogg_encoder_aspect.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/ogg_helper.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/ogg_mapping.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/stream_decoder.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/stream_encoder.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/stream_encoder_framing.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/window.c \
$(LIBFLAC_DIR)/flac/src/libFLAC/bitwriter.c \
FLACStreamEncoder.cpp \
FlacUtil.cpp
LAME_LIBMP3_SRC_FILES := \
$(LAME_LIBMP3_DIR)/bitstream.c \
$(LAME_LIBMP3_DIR)/fft.c \
$(LAME_LIBMP3_DIR)/id3tag.c \
$(LAME_LIBMP3_DIR)/mpglib_interface.c \
$(LAME_LIBMP3_DIR)/presets.c \
$(LAME_LIBMP3_DIR)/quantize.c \
$(LAME_LIBMP3_DIR)/reservoir.c \
$(LAME_LIBMP3_DIR)/tables.c \
$(LAME_LIBMP3_DIR)/util.c \
$(LAME_LIBMP3_DIR)/VbrTag.c \
$(LAME_LIBMP3_DIR)/encoder.c \
$(LAME_LIBMP3_DIR)/gain_analysis.c \
$(LAME_LIBMP3_DIR)/lame.c \
$(LAME_LIBMP3_DIR)/newmdct.c \
$(LAME_LIBMP3_DIR)/psymodel.c \
$(LAME_LIBMP3_DIR)/quantize_pvt.c \
$(LAME_LIBMP3_DIR)/set_get.c \
$(LAME_LIBMP3_DIR)/takehiro.c \
$(LAME_LIBMP3_DIR)/vbrquantize.c \
$(LAME_LIBMP3_DIR)/version.c \
simple_lame_lib.c \
com_nll_nativelibs_LameEncoder.cpp \
com_nll_nativelibs_Lame.c
LIBVORBIS_LIBOGG_SRC_FILES := \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/mdct.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/smallft.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/block.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/envelope.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/window.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/lsp.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/lpc.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/analysis.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/synthesis.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/psy.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/info.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/floor1.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/floor0.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/res0.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/mapping0.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/registry.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/codebook.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/sharedbook.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/lookup.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/bitrate.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/vorbisfile.c \
$(LIBVORBIS_LIBOGG_DIR)/libvorbis/vorbisenc.c \
com_nll_nativelibs_VorbisEncoder.c
PV_TOP := $(LOCAL_PATH)/libopencoreamr/opencore-amr-main
PV_INCLUDES := $(LOCAL_PATH)/libopencoreamr/opencode-amr-oscl \
$(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/include \
$(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/src \
$(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/dec/include \
$(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/dec/src \
$(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/enc/include \
$(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/enc/src \
$(PV_TOP)/codecs_v2/audio/gsm_amr/common/dec/include
#include $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/Android.mk
#include $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/dec/Android.mk
#include $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/enc/Android.mk
LIB_OPENCORE_AMR_DIR := \
$(LIB_OPENCORE_AMR_DIR)/com_nll_nativelibs_amr_wrapper.cpp \
$(LIB_OPENCORE_AMR_DIR)/com_nll_nativelibs_amr_encoder.cpp\
$(LIB_OPENCORE_AMR_DIR)/com_nll_nativelibs_amr_decoder.cpp
LOCAL_SRC_FILES := $(LIBFLAC_SRC_FILES) $(LAME_LIBMP3_SRC_FILES) $(LIBVORBIS_LIBOGG_SRC_FILES) $(LIB_OPENCORE_AMR_DIR)
LOCAL_C_INCLUDES := $(PV_INCLUDES)
LIBVORBIS_LIBOGG_NATIVE_FLAGS := -I$(LOCAL_PATH)/$(LIBVORBIS_LIBOGG_DIR)/include -I$(LOCAL_PATH)/$(LIBVORBIS_LIBOGG_DIR)/libvorbis/
LAME_LIBMP3G_NATIVE_FLAGS := -I$(LOCAL_PATH)/$(LAME_LIBMP3_DIR) -I$(LOCAL_PATH)/$(LAME_LIBMP3_DIR)/vector
LIBFLAC_NATIVE_FLAGS := -I$(LOCAL_PATH)/$(LIBFLAC_DIR)/config -I$(LOCAL_PATH)/$(LIBFLAC_DIR)/ogg/include -I$(LOCAL_PATH)/$(LIBFLAC_DIR)/flac/include -I$(LOCAL_PATH)/$(LIBFLAC_DIR)/flac/src/libFLAC/include -DVERSION=\"1.2\"
LOCAL_CFLAGS += $(LIBVORBIS_LIBOGG_NATIVE_FLAGS) $(LAME_LIBMP3G_NATIVE_FLAGS) $(LIBFLAC_NATIVE_FLAGS) \
-I. \
-fsigned-char \
-DSTDC_HEADERS \
-ffast-math
LOCAL_CPPFLAGS += -std=c++11
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
ifeq ($(TARGET_ARCH),arm)
LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp
endif
include $(BUILD_SHARED_LIBRARY)
答案 0 :(得分:0)
确保您使用“”来引用丢失的.h文件。
大多数时候,开发人员错误地使用&lt;&gt;用于引用本地文件而不是“”
#include <> is used to include framework's/library files
#include "" is used to include your own local cpp header files