本文主要是介绍ndk 编译常见错误-你懂得,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
=====================
error:
Compile++ thumb : AndroidCamera <= bufferqueue.cpp
jni/newBuffer/bufferqueue.cpp:10:17: fatal error: queue: No such file or directory
***
Answer:
添加Application.mk:
APP_CFLAGS += -fexceptions
APP_STL := gnustl_static
=====================
=====================
error:
error: 'printf' was not declared in this scope
***
Answer:添加头
#include "stdio.h"
=====================
=====================
error:
/Users/ericyang/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/AndroidCamera/newDecoder/DecodeLib.o: in function initDecode():jni/newDecoder/DecodeLib.cpp:29: error: undefined reference to 'avcodec_find_decoder'
***
Answer:
=====================
//没有在.h文件中找到方法
'CreateBQueue' was not declared in this scope
//没有在.c/.cpp中找到对应的实现
AndroidCamera.cpp:58: error: undefined reference to 'CreateBQueue'
=====================
error:
/Users/ericyang/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/libavcodec.a: no archive symbol table (run ranlib)
***
Answer:
victormatoiMac:newDecoder ericyang$ lipo -info libavcodec.a
input file libavcodec.a is not a fat file
Non-fat file: libavcodec.a is architecture: armv7
victormatoiMac:newDecoder ericyang$ lipo -info libavformat.a
input file libavformat.a is not a fat file
Non-fat file: libavformat.a is architecture: armv7
victormatoiMac:newDecoder ericyang$ lipo -info libavutil.a
input file libavutil.a is not a fat file
Non-fat file: libavutil.a is architecture: armv7
victormatoiMac:TestCamera ericyang$ lipo -info jni/libx264.a
lipo: archive with no architecture specification: jni/libx264.a (can't determine architecture for it)
victormatoiMac:TestCamera ericyang$ lipo -info jni/libCorePlot-CocoaTouch.a
input file jni/libCorePlot-CocoaTouch.a is not a fat file
Non-fat file: jni/libCorePlot-CocoaTouch.a is architecture: armv7
victormatoiMac:newDecoder ericyang$ ranlib libavcodec.a
victormatoiMac:newDecoder ericyang$ ranlib libavformat.a
ranlib: file: libavformat.a(os_support.o) has no symbols
victormatoiMac:newDecoder ericyang$ ranlib libavutil.a
=====================
old archive libiary--error---0.10.2--
SharedLibrary : libAndroidCamera.so
/Users/ericyang/android-ndk-r8d/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/libavcodec.a: no archive symbol table (run ranlib)
/Users/ericyang/android-ndk-r8d/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/libavutil.a: no archive symbol table (run ranlib)
/Users/ericyang/android-ndk-r8d/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/libavformat.a: no archive symbol table (run ranlib)
jni/newDecoder/DecodeLib.cpp:25: error: undefined reference to 'avcodec_register'
jni/newDecoder/DecodeLib.cpp:29: error: undefined reference to 'avcodec_find_decoder'
jni/newDecoder/DecodeLib.cpp:39: error: undefined reference to 'avcodec_alloc_context3'
jni/newDecoder/DecodeLib.cpp:49: error: undefined reference to 'avcodec_alloc_frame'
jni/newDecoder/DecodeLib.cpp:60: error: undefined reference to 'avcodec_open2'
jni/newDecoder/DecodeLib.cpp:65: error: undefined reference to 'av_init_packet'
jni/newDecoder/DecodeLib.cpp:68: error: undefined reference to 'ff_h264_decoder'
jni/newDecoder/DecodeLib.cpp:74: error: undefined reference to 'avcodec_close'
jni/newDecoder/DecodeLib.cpp:80: error: undefined reference to 'av_free'
collect2: error: ld returned 1 exit status
old archive libiary--error---0.81--
=====================
In file included from /Users/ericyang/android-ndk-r8d/platforms/android-14/arch-arm/usr/include/stdlib.h:40:0,from jni/newDecoder/ffmpeg/libavutil/log.c:32:
/Users/ericyang/android-ndk-r8d/platforms/android-14/arch-arm/usr/include/string.h:58:15: note: previous declaration of 'strncasecmp' was here
jni/newDecoder/ffmpeg/libavutil/log.c: In function 'colored_fputs':
jni/newDecoder/ffmpeg/libavutil/log.c:109:21: error: implicit declaration of function 'isatty' [-Werror=implicit-function-declaration]
** 移除 Werror
=====================
/Users/ericyang/android-ndk-r8d/platforms/android-14/arch-arm/usr/include/string.h:58:15: note: previous declaration of 'strncasecmp' was here
In file included from jni/newDecoder/ffmpeg/libavutil/parseutils.c:31:0:
jni/newDecoder/ffmpeg/libavutil/parseutils.h:146:25: warning: 'struct tm' declared inside parameter list [enabled by default]
jni/newDecoder/ffmpeg/libavutil/parseutils.h:146:25: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
jni/newDecoder/ffmpeg/libavutil/parseutils.c:450:74: warning: 'struct tm' declared inside parameter list [enabled by default]
jni/newDecoder/ffmpeg/libavutil/parseutils.c: In function 'small_strptime':
jni/newDecoder/ffmpeg/libavutil/parseutils.c:465:19: error: dereferencing pointer to incomplete type
jni/newDecoder/ffmpeg/libavutil/parseutils.c:471:19: error: dereferencing pointer to incomplete type
jni/newDecoder/ffmpeg/libavutil/parseutils.c:477:19: error: dereferencing pointer to incomplete type
jni/newDecoder/ffmpeg/libavutil/parseutils.c:483:19: error: dereferencing pointer to incomplete type
jni/newDecoder/ffmpeg/libavutil/parseutils.c:489:19: error: dereferencing pointer to incomplete type
jni/newDecoder/ffmpeg/libavutil/parseutils.c:495:19: error: dereferencing pointer to incomplete type
=====================
=====================
=====================
=====================
=====================
=====================
=====================
=====================
error:
***
Answer:
6.1、error: libavcodec/codec_names.h: No such file or directory
源文档 http://bbs.rosoo.net/thread-13749-1-1.html
在ffmpeg目录下运行
cat libavcodec/avcodec.h | libavcodec/codec_names.sh config.h libavcodec/codec_names.h
=====================
编译10分钟左右,最后编译成功的log
Install : libAndroidCamera.so => libs/armeabi/libAndroidCamera.so
=====================
error:
***
Answer:
=====================
这篇关于ndk 编译常见错误-你懂得的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!