【问题标题】:Windows libs for ffmpeg don't link (visual studio)?ffmpeg 的 Windows 库不链接(Visual Studio)?
【发布时间】:2013-10-30 03:19:12
【问题描述】:

所以,我正在尝试让我正在编写的项目链接到 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 吗?有什么理由必须这样吗?

【问题讨论】:

  • 由于您的链接器错误消息中的函数标识符处没有 _ 前缀,我怀疑您忘记将您使用的 ffmpeg 包含文件放在“extern "C" { }' 部分中。跨度>
  • 嗯,就是这样。我花了很多时间在这么简单的事情上。下次我会努力记住这一点。谢谢。

标签: c++ windows visual-studio-2010 linker ffmpeg


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2013-06-17
    • 1970-01-01
    • 2014-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-08
    相关资源
    最近更新 更多