Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC9.0 VC10.0
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 8-Sep-10 8:28am
Edited 9-Sep-10 0:09am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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[^]
  Permalink  
Comments
Kurt Degiorgio at 12-May-11 10:47am
   
reason for 1: wrong answer look at my answer.
Albert Holguin at 12-May-11 10:51am
   
you're wrong, you can still do it from studio...
Kurt Degiorgio at 12-May-11 11:13am
   
yes but you need to configure the studio to do what i did below..
Albert Holguin at 12-May-11 11:14am
   
exactly
Albert Holguin at 12-May-11 11:14am
   
so how is my answer wrong? ...that's right, its not...
Kurt Degiorgio at 12-May-11 11:19am
   
hmm seems that i clicked on the wrong link, i apologize I have seen to many bad advice on this forum when it comes to driver development and that I have assumed wrongly.
 
I changed my rating again to reflect this :)
 
in my defense my answer is correct as well. since it can be done with out visual studio. (most ppl do it like that)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 555
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 12 May 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100