Incompatible Implicit Declaration of Built-In Function Warning Using NDK with LAME(使用带有 LAME 的 NDK 的内置函数警告的不兼容隐式声明)
问题描述
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
The gist of this is that it allows one to use the LAME MP3 encoder with JNI.
I followed each of the steps mentioned in the tutorial. My project is located at
C:workspace
and is called '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.
I'm running Windows 7 on a 64-bit machine. I do have Cygwin and NDK installed and have tested that my setup works on another project that I'm working on. However, when I go to
/cygdrive/c/workspace/LAME_Test/jni
on Cygwin and issue the following command
/cygdrive/c/Android/android-ndk-r8b/ndk-build
given that the NDK is located at
C:Androidandroid-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.
P.S: I will add that I was able to build + run the sample project in the link above (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
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
The key for me was to ensure that the following line was added to my Android.mk file
LOCAL_CFLAGS = -DSTDC_HEADERS
as mentioned by James Zhang.
I'm enclosing my complete makefile below this post so what I'm saying is perfectly clear.
Contents of Updated Android.mk File
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)
这篇关于使用带有 LAME 的 NDK 的内置函数警告的不兼容隐式声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用带有 LAME 的 NDK 的内置函数警告的不兼容隐式声明


- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- android 4中的android RadioButton问题 2022-01-01