简体   繁体   English

使用带有LAME的NDK的内置函数警告的不兼容的隐式声明

[英]Incompatible Implicit Declaration of Built-In Function Warning Using NDK with LAME

I'm trying to follow the tutorial located at the following location 我正在尝试按照位于以下位置的教程进行操作

http://developer.samsung.com/android/technical-docs/Porting-and-using-LAME-MP3-on-Android-with-JNI http://developer.samsung.com/android/technical-docs/Porting-and-using-LAME-MP3-on-Android-with-JNI

The gist of this is that it allows one to use the LAME MP3 encoder with JNI. 其中的要点是它允许人们使用带有JNI的LAME MP3编码器。

I followed each of the steps mentioned in the tutorial. 我按照教程中提到的每个步骤进行操作。 My project is located at 我的项目位于

C:\workspace\

and is called 'LAME_Test'. 并被称为'LAME_Test'。 Per the section labeled Compilation with NDK in the tutorial, I went ahead and made a makefile called 'Android.mk' as is enclosed below this post. 根据教程中标有Compilation with NDK的部分,我继续编写了一个名为'Android.mk'的makefile,如下所示。

I'm running Windows 7 on a 64-bit machine. 我在64位计算机上运行Windows 7。 I do have Cygwin and NDK installed and have tested that my setup works on another project that I'm working on. 我安装了Cygwin和NDK,并测试了我的设置是否适用于我正在处理的另一个项目。 However, when I go to 但是,当我去

/cygdrive/c/workspace/LAME_Test/jni

on Cygwin and issue the following command 在Cygwin上发出以下命令

 /cygdrive/c/Android/android-ndk-r8b/ndk-build

given that the NDK is located at 鉴于NDK位于

C:\Android\android-ndk-r8b

the compilation spits out a bunch of warnings like these 编译吐出一堆像这样的警告

warning: incompatible implicit declaration of built-in function 'memset' [enabled by default]                                                                                                   

I'm enclosing a small snippet of the warnings at the bottom of this post (because the list of warnings is really big and may just add clutter - rather than add value). 我在这篇帖子的底部附上了一小段警告(因为警告列表真的很大,可能只是增加了混乱 - 而不是增加价值)。

Was wondering if there's a slick way to resolve these warnings and get a nice, clean, compile. 想知道是否有一种灵巧的方法来解决这些警告并得到一个漂亮,干净,编译。

PS: I will add that I was able to build + run the sample project in the link above (LAME4Android). PS:我将补充一点,我能够在上面的链接(LAME4Android)中构建+运行示例项目。 This required the compilation of the native code. 这需要编译本机代码。 So, it looks like the the project does, in fact, build fine despite all the warnings . 因此,看起来该项目实际上尽管发出了所有警告但仍然很好。 I initially thought it was broken because of the warnings. 我最初认为它因为警告而被打破了。 However, it would indeed be really great if there were some way to fix the warnings. 但是,如果有某种方法来修复警告,那确实会很棒。

Contents of Android.mk File Android.mk文件的内容

LOCAL_PATH := $(call my-dir)

    include $(CLEAR_VARS)

    LOCAL_MODULE        := libmp3lame
    LOCAL_SRC_FILES     := \
    ./libmp3lame/bitstream.c \
    ./libmp3lame/encoder.c \
    ./libmp3lame/fft.c \
    ./libmp3lame/gain_analysis.c \
    ./libmp3lame/id3tag.c \
    ./libmp3lame/lame.c \
    ./libmp3lame/mpglib_interface.c \
    ./libmp3lame/newmdct.c \
    ./libmp3lame/presets.c \
    ./libmp3lame/psymodel.c \
    ./libmp3lame/quantize.c \
    ./libmp3lame/quantize_pvt.c \
    ./libmp3lame/reservoir.c \
    ./libmp3lame/set_get.c \
    ./libmp3lame/tables.c \
    ./libmp3lame/takehiro.c \
    ./libmp3lame/util.c \
    ./libmp3lame/vbrquantize.c \
    ./libmp3lame/VbrTag.c \
    ./libmp3lame/version.c

    LOCAL_LDLIBS := -llog

    include $(BUILD_SHARED_LIBRARY)

Log of Incompatible Implicit Declaration of Built-In Function Warnings 记录内置函数警告的不兼容隐式声明

$ /cygdrive/c/Android/android-ndk-r8b/ndk-build
Cygwin         : Generating dependency file converter script
Compile thumb  : mp3lame <= bitstream.c
Compile thumb  : mp3lame <= encoder.c
C:/workspace/LAME_Test/jni/./libmp3lame/encoder.c: In function 'lame_encode_frame_init':
C:/workspace/LAME_Test/jni/./libmp3lame/encoder.c:202:9: warning: incompatible implicit declaration of built-in function 'memset' [enabled by default]                                                                                                 
C:/workspace/LAME_Test/jni/./libmp3lame/encoder.c: In function 'lame_encode_mp3_frame':
C:/workspace/LAME_Test/jni/./libmp3lame/encoder.c:471:17: warning: incompatible implicit declaration of built-in function 'bcopy' [enabled by default]                                                                                                    
Compile thumb  : mp3lame <= fft.c
Compile thumb  : mp3lame <= gain_analysis.c
and so on...

After a lot of searching it looks like the answer I was looking for was found here 经过大量的搜索,看起来我在寻找的答案就在这里找到了

Lame MP3 Encoder compile for Android Lame MP3 Encoder编译为Android

The key for me was to ensure that the following line was added to my Android.mk file 对我而言,关键是要确保将以下行添加到我的Android.mk文件中

LOCAL_CFLAGS = -DSTDC_HEADERS

as mentioned by James Zhang. 正如James Zhang所说。

I'm enclosing my complete makefile below this post so what I'm saying is perfectly clear. 我在这篇文章下面附上我的完整makefile,所以我说的非常清楚。

Contents of Updated Android.mk File 更新的Android.mk文件的内容

LOCAL_PATH := $(call my-dir)

    include $(CLEAR_VARS)

    LOCAL_MODULE        := libmp3lame
    LOCAL_SRC_FILES     := \
    ./libmp3lame/bitstream.c \
    ./libmp3lame/encoder.c \
    ./libmp3lame/fft.c \
    ./libmp3lame/gain_analysis.c \
    ./libmp3lame/id3tag.c \
    ./libmp3lame/lame.c \
    ./libmp3lame/mpglib_interface.c \
    ./libmp3lame/newmdct.c \
    ./libmp3lame/presets.c \
    ./libmp3lame/psymodel.c \
    ./libmp3lame/quantize.c \
    ./libmp3lame/quantize_pvt.c \
    ./libmp3lame/reservoir.c \
    ./libmp3lame/set_get.c \
    ./libmp3lame/tables.c \
    ./libmp3lame/takehiro.c \
    ./libmp3lame/util.c \
    ./libmp3lame/vbrquantize.c \
    ./libmp3lame/VbrTag.c \
    ./libmp3lame/version.c 

    LOCAL_LDLIBS := -llog
    LOCAL_CFLAGS = -DSTDC_HEADERS

    include $(BUILD_SHARED_LIBRARY)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM