5

因此,我正在尝试获取我正在编写的项目以链接到 ffmpeg 库,但我不断收到链接器错误:

1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "struct AVCodec * __cdecl avcodec_find_encoder(enum AVCodecID)" (?avcodec_find_encoder@@YAPEAUAVCodec@@W4AVCodecID@@@Z)
1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "int __cdecl av_dict_set(struct AVDictionary * *,char const *,char const *,int)" (?av_dict_set@@YAHPEAPEAUAVDictionary@@PEBD1H@Z)
1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "int __cdecl avcodec_encode_video(struct AVCodecContext *,unsigned char *,int,struct AVFrame const *)" (?avcodec_encode_video@@YAHPEAUAVCodecContext@@PEAEHPEBUAVFrame@@@Z)
1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "struct AVCodecContext * __cdecl avcodec_alloc_context3(struct AVCodec const *)" (?avcodec_alloc_context3@@YAPEAUAVCodecContext@@PEBUAVCodec@@@Z)
1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "struct AVFrame * __cdecl avcodec_alloc_frame(void)" (?avcodec_alloc_frame@@YAPEAUAVFrame@@XZ)
1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "void __cdecl av_free(void *)" (?av_free@@YAXPEAX@Z)
1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "int __cdecl avcodec_open2(struct AVCodecContext *,struct AVCodec const *,struct AVDictionary * *)" (?avcodec_open2@@YAHPEAUAVCodecContext@@PEBUAVCodec@@PEAPEAUAVDictionary@@@Z)
1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "int __cdecl avcodec_close(struct AVCodecContext *)" (?avcodec_close@@YAHPEAUAVCodecContext@@@Z)
1>C:\STEAMiE\usr\modules\LASReader\win32\Release\LASReader.exe : fatal error LNK1120: 8 unresolved externals

我从以下位置下载了开发包:

http://ffmpeg.zeranoe.com/builds/

但是当我像往常一样链接库时,我得到了链接器错误。这个包是否与我尝试使用的所有其他库有所不同,我只需要 .h/.libs 吗?有理由必须这样吗?

4

1 回答 1

10

由于链接器错误消息中的函数标识符处没有 _ 前缀,我怀疑您忘记将您使用的 ffmpeg 包含文件放在“extern“C”{}”部分中。

于 2013-10-21T16:37:11.920 回答