Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
These days I'm working on writing driver. I've downloaded WDK version 7.1.0
from Microsoft download center and in my source code I include ndis.h but when I compile it these messages have been shown:

------ Build started: Project: sys_test, Configuration: Debug Win32 ------
Compiling...
source.cpp
e:\wdk\ndis.h(2531) : error C2065: 'PAGE_SHIFT' : undeclared identifier
e:\wdk\ndis.h(2531) : error C2065: 'PAGE_SIZE' : undeclared identifier
e:\wdk\ndis.h(2531) : error C2065: 'PAGE_SIZE' : undeclared identifier
e:\wdk\ndis.h(2531) : error C2065: 'PAGE_SIZE' : undeclared identifier
e:\wdk\ndis.h(2531) : error C2065: 'PAGE_SHIFT' : undeclared identifier


Why does it say 'PAGE_SHIFT' and 'PAGE_SIZE' are undeclared? Is it necessary to include another header files?

Thanks

------------------------------------
I did the solution you said but this time the compiler couldn't detect my CPU architecture. I got these:

ClCompile:
  source.cpp
d:\winddk\7600.16385.1\inc\ddk\wdm.h(14198): fatal error C1189: #error :  "No target architecture defined"
Build FAILED.


But I know that my CPU architecture is x86.
Posted
Updated 8-Sep-10 23:09pm
v2

Again, here's a decent article on why the "No target architecture defined" error comes up, there's environment variables missing that are usually set up by other files:
http://mcdermottcybersecurity.com/articles/64-bit-device-driver-development[^]
 
Share this answer
 
Comments
Kurt Degiorgio 12-May-11 10:47am    
reason for 1: wrong answer look at my answer.
Albert Holguin 12-May-11 10:51am    
you're wrong, you can still do it from studio...
Kurt Degiorgio 12-May-11 11:13am    
yes but you need to configure the studio to do what i did below..
Albert Holguin 12-May-11 11:14am    
exactly
Albert Holguin 12-May-11 11:14am    
so how is my answer wrong? ...that's right, its not...
Did you include wdm.h?
These constants are defined in that.

Why is the path to ndis.h showing e:\wdk\ndis.h?
On my machine it is C:\WinDDK\7600.16385.0\inc\ddk\ndis.h.

If you have copied the headers to the folder, it is the wrong way to do it.
You have to set the installed path in your project configuration.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900