Ffmpeg最新的visual studio构建或链接到(.a)库



有问题。我需要链接ffmpeg(特别是libavcodec)静态到visual studio 2008项目。

我在互联网上找到了一些visual studio解决方案,但它们非常旧(大约0.6版本),我需要最新版本,所以这种方式对我来说不是一个选择。

接下来,我使用MinGW/msys进行静态构建(使用——enable-satic——disable-shared标志),并在输出中获得(*.a)库。在Visual Studio中,我转到链接器属性并添加到附加依赖项(链接器->输入)libvacodec。A和libgcca。然后我写了一个简单的应用程序:

#include <stdio.h>
#include <stdlib.h>
extern "C"
{
   #ifdef  __STDC_CONSTANT_MACROS
      #define __STDC_CONSTANT_MACROS
   #endif
      #include "libavcodec/avcodec.h"    
 }

#include "libavformat/avformat.h"
      int main()
   {
    av_register_all();
    return 0;
   }

编译成功,但链接失败。出现错误:

error  LNK2019: unresolved external symbol "void __cdecl av_register(void)" (?av_register_all@@YAXXZ) referenced in function _main.

所以,有两个问题:

  1. 如何链接Visual Studio应用程序与libavcodec。一个?

  2. 如果可能的话,我在哪里可以得到包括ffmpeg最新版本的visual studio解决方案?

提前感谢!!

  1. 就像你使用。lib文件一样,.a是相同的东西,只是名称不同。如果对您来说更容易,重命名libavcodec。

最新更新