1、編譯時遇到問題
1.編譯的時候出現如下錯誤:
.........
/Users/zhaodebo/workspace/code/MyNdk/app/src/main/jni/include/libavutil/imgutils.h:80:28: error: 'uint8_t' was not declared in this scope/Users/zhaodebo/workspace/code/MyNdk/app/src/main/jni/include/libavutil/imgutils.h:80:37: error: 'data' was not declared in this scope/Users/zhaodebo/workspace/code/MyNdk/app/src/main/jni/include/libavutil/imgutils.h:80:46: error: expected PRimary-expression before 'enum'/Users/zhaodebo/workspace/code/MyNdk/app/src/main/jni/include/libavutil/imgutils.h:80:74: error: expected primary-expression before 'int'/Users/zhaodebo/workspace/code/MyNdk/app/src/main/jniinclude/libavutil/imgutils.h:81:28: error: 'uint8_t' was not declared in this scope/Users/zhaodebo/workspace/code/MyNdk/app/src/main/jni/include/libavutil/imgutils.h:81:37: error: 'ptr' was not declared in this scope/Users/zhaodebo/workspace/code/MyNdk/app/src/main/jniinclude/libavutil/imgutils.h:81:42: error: expected primary-expression before 'const'/Users/zhaodebo/workspace/code/MyNdk/app/src/main/jni/include/libavutil/imgutils.h:81:64: error: expression list treated as compound expression in initializer [-fpermissive]/Users/zhaodebo/workspace/code/MyNdk/app/src/main/jni/include/libavutil/imgutils.h:93:20: error: 'uint8_t' was not declared in this scope.......
解決辦法:這是因為找不到uint8_t這些定義,網上說什么修改ffmpeg里面的某個common.h頭文件加上這些定義什么的呀,其實完全不用這么做,本身有個系統文件是有這些定義的,加上頭文件#include <inttypes.h>即可,注意需要加在引用ffmpeg頭文件之前。
此問題解決辦法引用:http://blog.csdn.net/cjj198561/article/details/33417965
2、編譯時遇到問題
/Users/zhaodebo/workspace/code/MyNdk/app/src/main/jni/include/libavutil/common.h: In function 'int32_t av_cl 解決辦法:這個時候需要手動在你的代碼里面加上幾句代碼,注意需要加在引用ffmpeg頭文件之前。直接上代碼: #ifndef __MICloudPub___H264Decoder__#define __MICloudPub___H264Decoder__#ifndef UINT64_C#define UINT64_C(value) __CONCAT(value, ULL)#endif #endif 3、編譯出現問題: /Users/zhaodebo/workspace/code/MyNdk/app/src/main/jni/MyLibrary.cpp:19: error: undefined reference to 'avcodec_register_all()'collect2: error: ld returned 1 exit status 明明有這個頭文件和函數,但就是找不到。 解決辦法: 在Android.mk中添加如下一句話: 4、問題: /Users/zhaodebo/workspace/code/MyNdk/app/src/main/jni/include/libavutil/avutil.h:209:1: error: expected initializer before 'ring' ring(enum AVMediaType media_type); 解決辦法: 關鍵詞“expected initializer before...”是說在before后面提示地方附近有語法錯誤,注意排查。LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
新聞熱點
疑難解答