包含dshow.h导致定义错误 [英] Inclusion of dshow.h results in definition errors

查看:1644
本文介绍了包含dshow.h导致定义错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用DirectShow进行音频播放。我有一个头文件,在顶部是:

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")

定义一个类。
当包括dshow.h时,我得到以下编译错误:

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):错误C2011:'_DDPIXELFORMAT':'struct'type redefinition

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):请参阅_DDPIXELFORMAT声明

c:\program files\microsoft sdks\windows\v7.0\include\ksmedia.h(5749) : see declaration of '_DDPIXELFORMAT'

C:\ Program Files \Microsoft SDKs\Windows\v7.0\\\\\\\\\\\\\\\\\\\\\\\\\\ddraw.h(2249):错误C2079:'_DDSURFACEDESC :: ddpfPixelFormat'使用未定义的struct'_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\\\\\\\\\\\\\\\(d64.h,2292):错误C2079:'_DDSURFACEDESC2 :: ddpfPixelFormat'使用未定义的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):错误C2011: tagTIMECODE_SAMPLE':'struct'type redefinition

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\\\\\ 5274):参见'tagTIMECODE_SAMPLE'的声明

c:\program files\microsoft sdks\windows\v7.0\include\ksmedia.h(5274) : see declaration of 'tagTIMECODE_SAMPLE'

我无法确定在这种情况下会导致这些错误。如果这有什么区别,头文件是MFC项目的一部分。任何建议?

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?

推荐答案

通过更改#include定义的顺序来修复此问题。我把上面的代码定义的头文件移动到顶部,它现在工作确定。必须是与另一个文件中的一些代码冲突,可能是一些directSound相关的东西。

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.

这篇关于包含dshow.h导致定义错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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