1

I'm working on building a Windows MFC application in Visual Studio 2010 using FFmpeg and SDL. However, I can't get the project to build after creating an MFC project from scratch and including the FFmpeg development libraries (avcodec.lib, avdevice.lib, avformat.lib, etc.). I'm using the development build from Zeranoe FFmpeg. I have configured the following in the Project Properties:

  1. Set VC++ Directories -> Include Directories (added the FFmpeg "include" directories)
  2. Set VC++ Directories -> Library Directories (to the FFmpeg "lib" directory)
  3. Set Linker -> Input -> Additional Dependencies (to include avcodec.lib, etc.)

For what it's worth, the build succeeds when I omit FFmpeg's "include\libavutil" include from the VC++ Directories -> Include Directories.

Below are some of the first build errors I'm receiving (I won't post all, since it's long). Any help would be appreciated.

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.

I've referenced both of these articles, which were of help:

spurgeon
  • 1,082
  • 11
  • 34

2 Answers2

4

I think what you did is this. When you did your first 2 steps

  1. Set VC++ Directories -> Include Directories (added the FFmpeg "include" directories)
  2. Set VC++ Directories -> Library Directories (to the FFmpeg "lib" directory)

You have included them at the top of the list before MFC and ATL paths. Please move them to the bottom of the list using the up/down buttons. This should solve the problem

cha
  • 10,301
  • 1
  • 18
  • 26
  • Thanks! That was my problem. For others who have the same problem, Visual Studio adds includes to the front of the list by default when using the Include Directories dialog. You have to manually move it to the $(IncludePath) variable to the front: `$(IncludePath);C:\lib\ffmpeg-20130110-git-2672b2c-win32-dev\include;...` – spurgeon Jan 11 '13 at 14:44
1

Have a look at Use FFmpeg in Visual Studio - it has a link to small Visual Studio 2010 project that builds against Zeranoe binaries.

Note that you need a inttypes.h file to succeed in building.

Your log shows issues with stdafx.cpp and this means that you have either search paths set wrong, or something is wrong in stdafx.h. Putting FFmpeg directories on top of search list might work out, however it might equally well break building for MFC part. I would rather have them on the bottom of the list, however the code itself should have the correct order of explicit #includes.

Community
  • 1
  • 1
Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • Thanks, I don't know how I missed that page on my SO search before posting, but I guess ultimately it wouldn't have solved my quirky includes ordering issue. I did include the `inttypes.h` previously, so that wasn't the issue. – spurgeon Jan 11 '13 at 14:45