阅读:1342回复:3
extern \"C\" { include <WDM.H> }
为什么要这么写?写 include <WDM.H>不可以吗?还有
Build Log --------------------Configuration: temp - Win32 Debug-------------------- Command Lines Creating temporary file \"H:\\DOCUME~1\\JOHNZH~1\\LOCALS~1\\Temp\\RSP2F2D.tmp\" with contents [ /nologo /Gz /MLd /W3 /Gm /Gi /Zi /Od /I \"\\NTDDK\\inc\" /D DBG=1 /D \"_X86_\" /D _WIN32_WINNT=0x500 /FR\"Debug/\" /Fp\"Debug/temp.pch\" /YX /Fo\"Debug/\" /Fd\"Debug/\" /FD /Gs -GF /c \"D:\\temp\\Driver.cpp\" \"D:\\temp\\EventLog.cpp\" \"D:\\temp\\Unicode.cpp\" ] Creating command line \"cl.exe @H:\\DOCUME~1\\JOHNZH~1\\LOCALS~1\\Temp\\RSP2F2D.tmp\" Creating temporary file \"H:\\DOCUME~1\\JOHNZH~1\\LOCALS~1\\Temp\\RSP2F2E.tmp\" with contents [ int64.lib ntoskrnl.lib hal.lib /nologo /base:\"0x10000\" /entry:\"DriverEntry\" /incremental:no /pdb:\"Debug/temp.pdb\" /debug /machine:I386 /nodefaultlib /out:\"Debug\\temp.SYS\" /pdbtype:con /libpath:\"\\NTDDK\\libchk\\i386\" -driver -subsystem:NATIVE,4.00 .\\Debug\\Driver.obj .\\Debug\\EventLog.obj .\\Debug\\Unicode.obj .\\Debug\\Msg.res ] Creating command line \"link.exe @H:\\DOCUME~1\\JOHNZH~1\\LOCALS~1\\Temp\\RSP2F2E.tmp\" Creating temporary file \"H:\\DOCUME~1\\JOHNZH~1\\LOCALS~1\\Temp\\RSP2F2F.bat\" with contents [ @echo off copy .\\Debug\\temp.SYS H:\\WINNT\\System32\\Drivers\\*.* ] Creating command line \"H:\\DOCUME~1\\JOHNZH~1\\LOCALS~1\\Temp\\RSP2F2F.bat\" Compiling... Driver.cpp F:\\NTDDK\\INC\\WDM.h(354) : error C2146: syntax error : missing \';\' before identifier \'Lock\' F:\\NTDDK\\INC\\WDM.h(354) : error C2501: \'PULONG_PTR\' : missing storage-class or type specifiers F:\\NTDDK\\INC\\WDM.h(354) : error C2501: \'Lock\' : missing storage-class or type specifiers F:\\NTDDK\\INC\\WDM.h(594) : error C2146: syntax error : missing \';\' before identifier \'KSPIN_LOCK\' F:\\NTDDK\\INC\\WDM.h(594) : fatal error C1004: unexpected end of file found EventLog.cpp F:\\NTDDK\\INC\\WDM.h(354) : error C2146: syntax error : missing \';\' before identifier \'Lock\' F:\\NTDDK\\INC\\WDM.h(354) : error C2501: \'PULONG_PTR\' : missing storage-class or type specifiers F:\\NTDDK\\INC\\WDM.h(354) : error C2501: \'Lock\' : missing storage-class or type specifiers F:\\NTDDK\\INC\\WDM.h(594) : error C2146: syntax error : missing \';\' before identifier \'KSPIN_LOCK\' F:\\NTDDK\\INC\\WDM.h(594) : fatal error C1004: unexpected end of file found Unicode.cpp F:\\NTDDK\\INC\\DDK\\NTDDK.h(370) : error C2146: syntax error : missing \';\' before identifier \'Lock\' F:\\NTDDK\\INC\\DDK\\NTDDK.h(370) : error C2501: \'PULONG_PTR\' : missing storage-class or type specifiers F:\\NTDDK\\INC\\DDK\\NTDDK.h(370) : error C2501: \'Lock\' : missing storage-class or type specifiers F:\\NTDDK\\INC\\DDK\\NTDDK.h(824) : error C2146: syntax error : missing \';\' before identifier \'KSPIN_LOCK\' F:\\NTDDK\\INC\\DDK\\NTDDK.h(824) : fatal error C1004: unexpected end of file found Error executing cl.exe. Output Window Creating command line \"bscmake.exe /nologo /o\"Debug/temp.bsc\" .\\Debug\\Driver.sbr .\\Debug\\EventLog.sbr .\\Debug\\Unicode.sbr\" Output Window Results temp.SYS - 15 error(s), 0 warning(s) 为什么会这样?WDM.H NTDDK.H没有错呀,他怎么就编译通不过呢? 原文件就是这样的: #pragma once extern \"C\" { #include <WDM.h> } #include \"Unicode.h\" #include \"EventLog.h\" #include \"Msg.h\" 谁告诉我为什么?? 环境:win2000professional+win2000ddk+vc6.0 |
|
沙发#
发布于:2002-11-09 09:51
因为你的文件用到c++的语法
所以需要用Extern“c”将wdm.h包起来 |
|
|
板凳#
发布于:2002-11-09 10:11
因为wdm.h是C的
|
|
|
地板#
发布于:2002-11-09 10:41
你include 了wdm.h和ntddk.h,但是他们的顺序应该放在所有其它路径的前面
具体的做法是在VC中增加两个路径:D:|ntddk\\inc和D:\\ntddk\\inc\\ddk,并把他们放到所有路径的最上面. 编译顺序很重要. |
|
|