【问题标题】:Unresolved external symbol when linking ffmpeg/avcodec with Visual Studio 2015?将 ffmpeg/avcodec 与 Visual Studio 2015 链接时无法解析的外部符号?
【发布时间】:2015-12-03 03:53:48
【问题描述】:

我正在尝试使用 Visual Studio 2015 构建 ffmpeg/avcodec 库,但它给了我以下链接错误:

allcodecs.obj : error LNK2001: unresolved external symbol ff_h263_vaapi_hwaccel 
allcodecs.obj : error LNK2001: unresolved external symbol ff_h263_vdpau_hwaccel
allcodecs.obj : error LNK2001: unresolved external symbol ff_h263_videotoolbox_hwaccel
...

问题出在这个宏https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/allcodecs.c#L34

#include "config.h"
#include "avcodec.h"
#include "version.h"

...

#define REGISTER_HWACCEL(X, x)                                      \
    {                                                               \
        extern AVHWAccel ff_##x##_hwaccel;                          \
        if (CONFIG_##X##_HWACCEL)                                   \
            av_register_hwaccel(&ff_##x##_hwaccel);                 \
    }

...

void avcodec_register_all(void)
{
    static int initialized;

    if (initialized)
        return;
    initialized = 1;

    /* hardware accelerators */
    REGISTER_HWACCEL(H263_VAAPI,        h263_vaapi);
    REGISTER_HWACCEL(H263_VIDEOTOOLBOX, h263_videotoolbox);
    ...

我不明白为什么当我的配置将它们设置为 0 时这些方法甚至会被声明

#define CONFIG_H263_VAAPI_HWACCEL 0
#define CONFIG_H263_VDPAU_HWACCEL 0
#define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
...

顺便说一句,当我使用 msys/make 工具时,它构建得很好。

【问题讨论】:

    标签: visual-studio ffmpeg


    【解决方案1】:

    您可能正在尝试将 C 代码与 C++ 名称修改联系起来。 试试:

    extern "C"
    {
    #include <avcodec.h>
    #include <avformat.h>
    }
    

    【讨论】:

    • 我没有在我的代码中使用库...我正在尝试构建库本身。
    猜你喜欢
    • 2016-06-08
    • 2014-05-15
    • 1970-01-01
    • 2020-11-06
    • 2015-10-30
    • 2020-04-30
    • 1970-01-01
    • 2013-06-15
    • 1970-01-01
    相关资源
    最近更新 更多