【发布时间】:2012-07-03 08:25:14
【问题描述】:
我正在尝试围绕 libavformat 构建一些视频阅读代码。在获得编译好的 DLL 和 .lib 文件 here 之后,我开始构建我的代码,即使我已经链接到提供的 .lib 文件中,链接器也找不到任何 libavformat 符号。
用dumpbin -headers 检查libavformat.lib 发现它导出了带有下划线前缀的所需函数。例如,当我想调用avformat_open_input 时,.lib 文件给出了_avformat_open_input。
为什么会这样,为什么我不能链接预编译的 dll?
【问题讨论】:
-
您的应用程序也是 x64 平台吗?另请在此处复制确切的错误消息。
-
我只是在构建一个 32 位应用程序。链接器错误只是您传统的 LibavVideoReader.obj :错误 LNK2019:未解析的外部符号“int __cdecl avformat_open_input(struct AVFormatContext * *,char const *,struct AVInputFormat *,struct AVDictionary * *)” (?avformat_open_input@@YAHPAPAUAVFormatContext@@PBDPAUAVInputFormat @@PAPAAUAVDictionary@@@Z) 在函数中引用...消息
-
您是将代码编译为 C 还是 C++?如果是后者,您是否确保这些库中的 C 声明包含在
extern "C"中?
标签: c++ visual-studio-2010 visual-c++ ffmpeg libavformat