PerKins Zhu

Le vent se lève,il faut tenter de vivre.

导航

当c++程序使用FFmpeg时,总是在编译生成时提示 “无法找到外部引用”,类似于:

严重性    代码    说明    项目    文件    行    禁止显示状态
错误    LNK2019    无法解析的外部符号 "struct AVCodec const * __cdecl avcodec_find_decoder(enum AVCodecID)" (?avcodec_find_decoder@@YAPEBUAVCodec@@W4AVCodecID@@@Z),函数 "void __cdecl decode_pcma_to_pcm(unsigned char *,int,short * *,int *)" (?decode_pcma_to_pcm@@YAXPEAEHPEAPEAFPEAH@Z) 中引用了该符号    mod_mbs    D:\myproject\visualCode\freeswitch\src\mod\applications\mod_mbs\mod_mbs.obj    1    

严重性    代码    说明    项目    文件    行    禁止显示状态
错误    LNK2019    无法解析的外部符号 "void __cdecl av_frame_free(struct AVFrame * *)" (?av_frame_free@@YAXPEAPEAUAVFrame@@@Z),函数 "void __cdecl decode_pcma_to_pcm(unsigned char *,int,short * *,int *)" (?decode_pcma_to_pcm@@YAXPEAEHPEAPEAFPEAH@Z) 中引用了该符号    mod_mbs    D:\myproject\visualCode\freeswitch\src\mod\applications\mod_mbs\mod_mbs.obj    1    

 

ffmpeg类库是基于c语音实现的,如果在c++中引用相关类库,则需要禁用名称修饰。

extern "C" {
 #include <libavcodec/avcodec.h>
 #include <libavformat/avformat.h>
  #include <libswresample/swresample.h>
}