在Visual Studio 2010中链接libavformat [英] Linking libavformat in Visual Studio 2010

查看:145
本文介绍了在Visual Studio 2010中链接libavformat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试围绕libavformat构建一些视频阅读代码.在此处获取编译的DLL和.lib文件之后,我将构建我的代码和链接器即使我已链接到提供的.lib文件中,也找不到任何libavformat符号.

I'm attempting to build some video-reading code around libavformat. After getting the compiled DLLs and .lib files here, I go to build my code, and the linker can't find any of the libavformat symbols even though I've linked in the provided .lib files.

dumpbin -headers检查libavformat.lib会发现它导出带有下划线前缀的所需功能.例如,当我想调用avformat_open_input时,.lib文件给出了_avformat_open_input.

Inspecting libavformat.lib with dumpbin -headers reveals that it exports the desired functions with an underscore prefix. For example, while I want to call avformat_open_input, the .lib file gives _avformat_open_input.

这是为什么,为什么我不能链接预编译的dll?

Why is this, and why can't I link the precompiled dlls?

推荐答案

您需要完成所有任务,才能将libavMSVC++结合使用.首先转到 Zeranoe

You need to do following all tasks to use libav with MSVC++. First goto Zeranoe

  1. 下载Shared版本,从bin文件夹复制所有.dll文件,并将它们粘贴到将生成exe的输出目录中.
  2. 下载Developer版本,从lib文件夹复制所有.lib文件,并将其粘贴到主c ++文件所在的位置(例如Folder-1\Folder-2其中Folder-1具有.sln文件,因此您必须将Folder-2中的.lib个文件)
  3. 从步骤2中下载的Developer版本中,复制include文件夹中的所有目录并将其粘贴到Folder-2中(请参阅步骤2中有关Folder-2的详细信息)
  4. 下载 inttypes.h stdint.h ,将其保存在此位置C:\Program Files\Microsoft Visual Studio 10.0\VC\include\文件夹中.
  5. 要包含头文件,请使用以下语法
  1. Download Shared Version, Copy all .dll files from bin folder and paste them in the output directory where exe will be generated.
  2. Download Developer Version, Copy all .lib files from lib folder and paste them with your main c++ file is located (e.g. Folder-1\Folder-2 Where Folder-1 has the .sln file so you have to put .lib files in Folder-2)
  3. From Developer Version you downloaded in Step 2 copy all directories from include folder and paste them in Folder-2 (See details about Folder-2 in step 2)
  4. Download inttypes.h and stdint.h, save it on this location C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ folder.
  5. To include header files use following syntax

您必须使用此extern,因为libavC库.

You have to use this extern because libav is a C library.

extern "C" {
    #include "libavcodec/avcodec.h"
    #include "libavdevice/avdevice.h"
    #include "libavfilter/avfilter.h"
    #include "libavformat/avformat.h"
    #include "libavutil/avutil.h"
}

这篇关于在Visual Studio 2010中链接libavformat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆