使用Windows SDK中的代码示例的未声明标识符 [英] Undeclared Identifiers using code examples from Windows SDK

查看:295
本文介绍了使用Windows SDK中的代码示例的未声明标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在研究一个与视频捕获设备一起使用的小型测试项目.我正在Windows 7 Professional上使用Visual Studios C ++ 2008 Express Edition.

MSDN帮助文件:(枚举视频捕获设备)http://msdn.microsoft.com/zh-cn/library/dd940326% 28VS.85%29.aspx

以一些代码为例,开始尝试此操作,我试图枚举连接到计算机的视频捕获设备,并显示其友好名称(如果找到).

但是,在编译时出现以下错误:
1> c:\ users \ kienan \ documents \ visual studio 2008 \ projects \ camtest \ camtest \ main.cpp( 36):错误C2065:'MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE':未声明的标识符
1> c:\ users \ kienan \ documents \ Visual Studio 2008 \ projects \ camtest \ camtest \ main.cpp(36):错误C2065:'MF_DEVSOURCE_ATTRIBUD_SOURCE_TYPE :未声明的标识符
1> c:\ users \ kienan \ documents \ visual studio 2008 \ projects \ camtest \ camtest \ main.cpp(46):错误C3861:'MFEnumDeviceSources':找不到标识符
1> ; c:\用户\ kienan \ documents \ Visual Studio 2008 \ projects \ camtest \ camtest \ main.cpp(73):错误C2065:"MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME":未声明的标识符
1> c:\ users \ kienan \ documents \ Visual Studio 2008 \ projects \ camtest \ camtest \ main.cpp(88):错误C2065:"MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME":未声明的标识符

我包括以下头文件:
Mfidl.h
Mfapi .h
Dshow.h
Strmif.h

我已将以下库链接到我的项目文件
Mfplat.lib
Mf.lib
Strmiids.lib
Quartz.lib

检查MF_DEVSOURCE_ATTRIBUTE_ *的文档并不表明我需要更多的头文件.以及其他许多功能(例如MFCreateAttributes)都没有编译器错误.

如果需要,我可以发布源代码.有谁知道为什么会这样吗? VSC ++ Express + Win7是否存在无法正确链接库/标头的问题?

预先感谢,

Kienan

Hello, I am working on a small test project to work with video capture devices. I am using Visual Studios C++ 2008 Express Edition on Windows 7 Professional.

MSDN Help file: (Enumerating video capture devices) http://msdn.microsoft.com/en-us/library/dd940326%28VS.85%29.aspx

Using some of the code as an example to start trying this out I am attempting to enumerate the video capture devices attached to my computer, along with displaying their friendly name (if found).

However, when compiling I receive the following errors:
1>c:\users\kienan\documents\visual studio 2008\projects\camtest\camtest\main.cpp(36) : error C2065: 'MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE' : undeclared identifier
1>c:\users\kienan\documents\visual studio 2008\projects\camtest\camtest\main.cpp(36) : error C2065: 'MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID' : undeclared identifier
1>c:\users\kienan\documents\visual studio 2008\projects\camtest\camtest\main.cpp(46) : error C3861: 'MFEnumDeviceSources': identifier not found
1>c:\users\kienan\documents\visual studio 2008\projects\camtest\camtest\main.cpp(73) : error C2065: 'MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME' : undeclared identifier
1>c:\users\kienan\documents\visual studio 2008\projects\camtest\camtest\main.cpp(88) : error C2065: 'MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME' : undeclared identifier

I have included the following header files:
Mfidl.h
Mfapi.h
Dshow.h
Strmif.h

I have linked the following libraries to my project file
Mfplat.lib
Mf.lib
Strmiids.lib
Quartz.lib

Checking the documentation for MF_DEVSOURCE_ATTRIBUTE_* does not show that I need more header files.
The library posted as required for MFEnumDeviceSources is included; and many other functions eg MFCreateAttributes are found without compiler error.

I could post my source if required. Does anybody have any ideas why this happens? Is there something with VSC++Express + Win7 that fails to have the right libraries / headers linked?

Thanks in advance,

Kienan

推荐答案

您必须针对Windows 7进行编译才能获取这些文件符号.为此,请在包含头文件之前#为NTDDI_VERSION定义适当的值.见

You must compile for Windows 7 to get these symbols.  To do that #define an appropriate value for NTDDI_VERSION prior to including the header files.  See

http://msdn.microsoft.com/en-us/library/aa383745(VS.85).aspx


这篇关于使用Windows SDK中的代码示例的未声明标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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