2013-01-11 136 views
1

我正在使用FFmpeg和SDL在Visual Studio 2010中构建Windows MFC应用程序。但是,我无法从头开始创建MFC项目并包括FFmpeg开发库(avcodec.lib,avdevice.lib,avformat.lib等)后生成项目。我正在使用Zeranoe FFmpeg的开发版本。我已经配置在项目属性如下:使用Visual Studio 2010,MFC和FFmpeg构建

  1. 集VC++目录 - >包含目录(加入FFmpeg的“包括”目录)
  2. 集VC++目录 - >库目录(到FFmpeg的“lib”目录)
  3. 设置链接器 - >输入 - >附加依赖(包括avcodec.lib等)

对于它的价值,当我忽略FFmpeg的“包括\ libavutil”生成成功包括从VC++目录 - >包括目录。

下面是我收到的第一个构建错误(我不会发布全部,因为它很长)。任何帮助,将不胜感激。

ClCompile: stdafx.cpp

c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atltime.h(371): error C3861: '_mktime64': identifier not found

c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atltime.h(386): error C3861: '_localtime64_s': identifier not found

c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atltime.h(409): error C3861: '_gmtime64_s': identifier not found

c:\program files\microsoft sdks\windows\v7.0a\include\intsafe.h(144): warning C4005: 'INT8_MIN' : macro redefinition

c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxtaskspane.h(279): error C2146: syntax error : missing ';' before identifier 'm_nLastAnimTime'

c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxribboncategory.h(282): error C2146: syntax error : missing ';' before identifier 'm_ActiveTime'

c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxdockingmanager.h(353): error C2146: syntax error : missing ';' before identifier 'm_clkLastTime'

Build FAILED.

我引用的这两篇论文,这是有帮助的:

回答

4

我想你做的是这样的。当你做你的第2个步骤

  1. 集VC++目录 - >包含目录(加入FFmpeg的 “包括” 目录)
  2. 集VC++目录 - >库目录 (到FFmpeg的 “LIB”目录)

您已将它们包括在MFC和ATL路径之前的列表顶部。请使用上/下按钮将它们移动到列表的底部。这应该解决的问题

+0

谢谢!那是我的问题。对于其他具有相同问题的人员,在使用“包含目录”对话框时,Visual Studio默认会将其添加到列表的前面。您必须手动将它移动到前面的$(IncludePath)变量:'$(IncludePath); C:\ lib \ ffmpeg-20130110-git-2672b2c-win32-dev \ include; ...' – spurgeon

1

看一看Use FFmpeg in Visual Studio - 它有一个link小Visual Studio 2010中的项目,建立对Zeranoe二进制文件。

请注意,您需要一个inttypes.h文件才能成功构建。

您的日志显示stdafx.cpp的问题,这意味着您的搜索路径设置错误或stdafx.h中有错误。将FFmpeg目录放在搜索列表的顶部可能会消失,但它也可能会破坏MFC部分的构建。我宁愿将它们放在列表的底部,但代码本身应该具有明确的#include s的正确顺序。

+0

谢谢,我不知道我在发布前如何错过了我的SO搜索页面,但我想最终它不会解决我的古怪包括订购问题。我之前包括'inttypes.h',所以这不是问题。 – spurgeon