自已写了一个驱动程序,编译时提示:
#error NTVERSION symbol must be defined to one of the following: 400, 'WDM',错误出在vdw.h,我打开vdw.h看到有几行关于NTVERSION的:
#ifdef _IA64_
extern "C" void __cdecl __mf(void);
#pragma intrinsic(__mf)
#endif#ifndef __VDW_VERSION__
#define __VDW_VERSION__ 250#ifndef NTVERSION
#error NTVERSION symbol must be defined to one of the following: 400, 'WDM'
#endif#define _WDM_   (NTVERSION == 'WDM')
#define _NT400_ (NTVERSION == 400)不知有哪位碰到过类似的问题,请问如何解决。

解决方案 »

  1.   

    这是因为未定义NTVERSION
    在你程序里加上
    #define NTVERSION
      

  2.   

    是最后两句的错误:#define _WDM_   (NTVERSION == 'WDM')
    #define _NT400_ (NTVERSION == 400)
    你注释掉其中一句试试,它要求版本只有一种。
      

  3.   

    忘了说,我用的是DriverSuites2.7和Win2000 DDK作开发,我按照上面两位的方法试了一下,但仍然编译通不过,其实.sys已经生成,我现在调试的是一个测试驱动程序的程序,用过DriverStuido的朋友都知道,DriverWorks Wizard向导一般会生成两个工程,一个是驱动,一个是用来测试的,我现在调试的就是这个测试的工程。我在程序中直接注释掉这两行,将NTVERSION定义成'WDM',但出现更多的编译错误:
    --------------------Configuration: Test_RegSample - Win32 Debug--------------------
    Compiling...
    RegSampleDevice.cpp
    E:\NTDDK\INC\DDK\ntddk.h(7914) : error C2146: syntax error : missing ';' before identifier 'InterruptTime'
    E:\NTDDK\INC\DDK\ntddk.h(7914) : error C2501: 'InterruptTime' : missing storage-class or type specifiers
    E:\NTDDK\INC\DDK\ntddk.h(7928) : error C2146: syntax error : missing ';' before identifier 'SystemTime'
    E:\NTDDK\INC\DDK\ntddk.h(7928) : error C2086: 'KSYSTEM_TIME' : redefinition
    E:\NTDDK\INC\DDK\ntddk.h(7928) : error C2501: 'SystemTime' : missing storage-class or type specifiers
    E:\NTDDK\INC\DDK\ntddk.h(7935) : error C2146: syntax error : missing ';' before identifier 'TimeZoneBias'
    E:\NTDDK\INC\DDK\ntddk.h(7935) : error C2086: 'KSYSTEM_TIME' : redefinition
    E:\NTDDK\INC\DDK\ntddk.h(7935) : error C2501: 'TimeZoneBias' : missing storage-class or type specifiers
    E:\NTDDK\INC\DDK\ntddk.h(9101) : error C2146: syntax error : missing ';' before identifier 'ContextRecord'
    E:\NTDDK\INC\DDK\ntddk.h(9101) : error C2501: 'PCONTEXT' : missing storage-class or type specifiers
    E:\NTDDK\INC\DDK\ntddk.h(9101) : error C2501: 'ContextRecord' : missing storage-class or type specifiers
    E:\NTDDK\INC\DDK\ntddk.h(10051) : error C2146: syntax error : missing ';' before identifier 'KeTickCount'
    E:\NTDDK\INC\DDK\ntddk.h(10051) : fatal error C1004: unexpected end of file found
    Error executing cl.exe.Test_RegSample.exe - 13 error(s), 0 warning(s)
    我搜索了一个KSYSTEM_TIME这个类,发现在我的机器没有这个类。
      

  4.   

    To danielxuao:
    不是这个问题,不知那位碰到过?