在C ++中包含Dshow.h时出错(OpenRTM) [英] Error when including Dshow.h in C++(OpenRTM)
问题描述
嗨!这花了我很多年。我一直在寻找谷歌寻找可能的解决方案,但到目前为止我还没有任何明确的解决方案。
当我在我的代码中包含Dshow.h时,我得到了一个错误。
当我在我的代码中放入#define WINVER 0x0400时,错误消失了,但我不想这样做。还有其他方法吗?
将WINVER更改为0x0400或更高版本不起作用。
我目前正在使用OpenRTM框架,我认为这与该问题有关。我尝试制作一个新项目,只是正常的项目,并且dshow包括在内,但是OpenRTM框架却没有。
这包含在服务端口中标题。
Hi! It's been taking me ages. I've been searching google for a possible solution but up until now I haven't had any clear solution.
When I include Dshow.h in my code I get an error.
When I put #define WINVER 0x0400 in my code the error disappears, but I don't want to do that. Are there any other ways?
Changing the WINVER to 0x0400 or higher does not work.
I am currently using OpenRTM framework and I think this has something to do with the issue. I tried making a new project, just the normal one, and the dshow included fine, but with the OpenRTM framework it does not.
This is included in the service port header.
#include <Windows.h>
#include <DShow.h>
错误7错误C2061:语法错误:标识符'HMONITOR'C:\Program Files(x86)\ Microsoft Office SDK \ Windows \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
我的操作系统是Windows 7 64位,我使用的是VC ++ 2010 for 32bit。
编辑:更新了问题。
Error 7 error C2061: syntax error : identifier 'HMONITOR' C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ddraw.h
My OS is Windows 7 64bit and I'm using VC++ 2010 for 32bit.
Updated the question.
推荐答案
你可以用自己的定义来解决它:
#define HMONITOR HANDLE
但要明确:这是一种解决方法。
you can do solve it with a own definition:
#define HMONITOR HANDLE
But to be clear: it is a workaround.
在DirectX包含之前,您需要包含Windows.h。 HMONITOR的声明在Windef.h中,由Windows.h自动包含。
You need to include "Windows.h" before your DirectX includes. The declaration of HMONITOR is in Windef.h, which is automatically included by Windows.h.
大多数Windows API和SDK头文件都需要WINVER
和/或_WIN32_WINNT
已定义。某些头文件会将这些文件设置为默认值或缺少其他定义。
为了安全起见,您应该始终在全局位置设置定义以用于所有源文件。您可以将它们添加到项目设置或首先包含在所有源文件中的项目特定包含文件中。另请参阅使用Windows标头 [< a href =http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspxtarget =_ blanktitle =New Window> ^ < MSDN中的/ a>]。
Most of the Windows API and SDK header files require thatWINVER
and/or_WIN32_WINNT
are defined. Some header files will set these to defaults or from other definitions when missing.
To be safe you should always set the definitions in a global place to be used for all source files. You can add them to your project settings or to a project specific include file that is included first in all source files. See also Using the Windows Headers[^] in the MSDN.
这篇关于在C ++中包含Dshow.h时出错(OpenRTM)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!