I am trying to do a few things using DirectShow for audio playback. I have a header file, at the top is:
#pragma once
#include <dshow.h>
#pragma comment(lib, "strmiids.lib")
and then it goes on to define a class. When including dshow.h I get the following complilation errors:
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\ddraw.h(703) : error C2011: '_DDPIXELFORMAT' : 'struct' type redefinition
c:\program files\microsoft sdks\windows\v7.0\include\ksmedia.h(5749) : see declaration of '_DDPIXELFORMAT'
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\ddraw.h(2249) : error C2079: '_DDSURFACEDESC::ddpfPixelFormat' uses undefined struct '_DDPIXELFORMAT'
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\ddraw.h(2292) : error C2079: '_DDSURFACEDESC2::ddpfPixelFormat' uses undefined struct '_DDPIXELFORMAT'
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\strmif.h(12918) : error C2011: 'tagTIMECODE_SAMPLE' : 'struct' type redefinition
c:\program files\microsoft sdks\windows\v7.0\include\ksmedia.h(5274) : see declaration of 'tagTIMECODE_SAMPLE'
I can't figure out what would cause these errors in this case. The header file is part of an MFC project if that makes any difference. Any advice?
I have faced this SDK integration error a couple times, most recently when integrating a win32 console app with a library that uses Windows CoreAudio and the error occurred with a stdafx.h:
Then to resolve the error, I added the following below the current includes:
Hopefully this will help someone in the future facing this issue. EB
Fixed this by changing the order of the #include definitions. I moved the header file that the above code was defined in to the top and it works ok now. Must have been a clash with some code in another file, possibly some directSound related stuff.