【问题标题】:including DDK headers包括 DDK 标头
【发布时间】:2012-01-30 03:41:12
【问题描述】:

我遇到了一些麻烦,包括从 Windows 驱动程序工具包到 Visual Studio 2010 的标头。谁能帮助我,我做错了什么?

我收到诸如 C1083 之类的错误消息:无法打开包含文件:'sal.h':没有这样的文件或目录。 如果我包含 SDK 目录,我会收到错误消息,例如类型重新定义。 如果我将 sal.h 复制到 DDK 目录,我会收到错误消息 C1083:无法打开包含文件:'codeanalysis\sourceannotations.h':没有这样的文件或目录。 如果我将 sourceannotations.h 文件复制到 DDK 目录,我会收到其他错误消息(见下文)

VC++ 目录设置:include directory settings

#include "stdafx.h"


#include <Winsock2.h>
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <strsafe.h>
#include <fwpmu.h>
#include <ndis.h>

Error   1   error C1083: Cannot open include file: 'codeanalysis\sourceannotations.h': No such file or directory    c:\winddk\7600.16385.1\inc\crt\sal.h    160 1   wfp
2   IntelliSense: cannot open source file "codeanalysis\sourceannotations.h"    c:\winddk\7600.16385.1\inc\crt\sal.h    160 1   
21  IntelliSense: cannot overload functions distinguished by return type alone  c:\winddk\7600.16385.1\inc\ddk\ntddk.h  2895    1   
22  IntelliSense: cannot overload functions distinguished by return type alone  c:\winddk\7600.16385.1\inc\ddk\ntddk.h  2907    1   
23  IntelliSense: cannot overload functions distinguished by return type alone  c:\winddk\7600.16385.1\inc\ddk\ntddk.h  2917    1   
8   IntelliSense: expected a ')'    c:\winddk\7600.16385.1\inc\api\fwptypes.h   345 49  
6   IntelliSense: expected a ';'    c:\winddk\7600.16385.1\inc\api\fwptypes.h   281 4   
9   IntelliSense: expected a ';'    c:\winddk\7600.16385.1\inc\api\fwptypes.h   364 1   
11  IntelliSense: expected a ';'    c:\winddk\7600.16385.1\inc\api\iketypes.h   370 1   
16  IntelliSense: expected a ';'    c:\winddk\7600.16385.1\inc\ddk\wdm.h    8838    1   
25  IntelliSense: expected a declaration    c:\winddk\7600.16385.1\inc\ddk\ntddk.h  15056   5   
4   IntelliSense: expected a type specifier c:\winddk\7600.16385.1\inc\api\fwptypes.h   275 18  
3   IntelliSense: expected an identifier    c:\winddk\7600.16385.1\inc\api\fwptypes.h   275 5   
7   IntelliSense: expected an identifier    c:\winddk\7600.16385.1\inc\api\fwptypes.h   345 5   
10  IntelliSense: expected an identifier    c:\winddk\7600.16385.1\inc\api\iketypes.h   369 2   
18  IntelliSense: expected an identifier    c:\winddk\7600.16385.1\inc\ddk\wdm.h    17964   1   
19  IntelliSense: expected an identifier    c:\winddk\7600.16385.1\inc\ddk\wdm.h    17970   9   
24  IntelliSense: expected an identifier    c:\winddk\7600.16385.1\inc\ddk\ntddk.h  15037   3   
14  IntelliSense: identifier "FWP_FILTER_ENUM_TYPE" is undefined    c:\winddk\7600.16385.1\inc\api\fwpmtypes.h  413 5   
12  IntelliSense: identifier "IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS0" is undefined    c:\winddk\7600.16385.1\inc\api\iketypes.h   418 5   
13  IntelliSense: identifier "IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS0" is undefined    c:\winddk\7600.16385.1\inc\api\iketypes.h   419 5   
20  IntelliSense: identifier "PCALLBACK_FUNCTION" is undefined  c:\winddk\7600.16385.1\inc\ddk\wdm.h    17994   10  
17  IntelliSense: identifier "TIME_FIELDS" is undefined c:\winddk\7600.16385.1\inc\ddk\wdm.h    9012    9   
15  IntelliSense: this declaration has no storage class or type specifier   c:\winddk\7600.16385.1\inc\ddk\wdm.h    8837    1   
5   IntelliSense: unexpected parenthesis after declaration of function "<error>" (malformed parameter list or invalid initializer?) c:\winddk\7600.16385.1\inc\api\fwptypes.h   278 4   

【问题讨论】:

  • 您是否尝试过重新排序包含? windows.h 在顶部,“stdafx.h”在最后?
  • 不把 stdafx.h 放在上面有,呃,有趣的效果。
  • @Niklas Hansson 这不是解决方案
  • @Niklas Hansson 我试过了,但我收到了其他错误消息...

标签: c visual-studio visual-studio-2010 wdk


【解决方案1】:

您不能将 SDK 中的标头与 DDK 中的标头混合。

所以取消选中继承父设置的框。那么您可能必须从 DDK 添加其他目录。

另外请注意,您也不能将 DDK 中的库与 SDK 中的库混合使用。所以你必须在那里做几乎相同的事情。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-06-27
    • 1970-01-01
    • 2019-09-26
    • 2015-02-03
    • 2012-08-11
    • 2011-07-11
    • 1970-01-01
    • 2020-07-11
    相关资源
    最近更新 更多