开发者

The right way to load WDK in MS Visual C++ 2008?

I have a project that includes a device driver and the developer is able to compile it. I installed MS Visual C++ 2008 and the first error was "fatal error C1083: Cannot open include file: 'ntddk.h': No such file or directory". I downloaded the WDK from Microsoft website and installed it, I also executed Start -> All Programs -> Windows Driver Kits -> WDK 7600.16385.1 -> Build Environments -> Windows XP and "x86 Checked Build Environment" and "x86 Free Build Environment".

The problem persist, so I realized that I have to add by hand the paths, I don't know what to add, so I tried:

MS Visual C++ 2008 -> Tools -> Options -> Projects and Solutions -> VC++ Directories -> Include File and I added C:\WinDDK\7600.16385.1\inc\ddk and now I get:

c:\winddk\7600.16385.1\inc\ddk\wdm.开发者_开发百科h(54) : fatal error C1083: Cannot open include file: 'ntdef.h': No such file or directory

I did find ntdef.h under C:\WinDDK\7600.16385.1\inc\api and I added it too, but now I got a lot of errors and warnings. Since this project compile fine on the developer workstation I believe it's a problem on my configuration.

What is the right paths to add to MSVC++ 2008 to compile device drivers?


To run your driver program(.c or .cpp file), instead of using the Visual C++ compiler (which will break down like this), you have to complile the program directly from the DDK build environment. Open the DDK build env (suitable version of Windows). In that, goto the directory which contains your program, then type "build -cZ" for compiling your program. If successfully complied, this will create a .sys file in some folders in the current directory. You can further install the .sys file like any other driver.


There are shortcuts set up by the DDK installation that set this up correctly according to the type of build that you want. If you want to be able to do this manually, those shortcuts should be your source of information.

Brief quote:

When the WDK is installed, it defines the Start menu shortcuts for several different build environments. To open a build environment window, use the following Start menu path: Start | All Programs | Windows Driver Kits | WDK_Version | Build Environment | Operating System | Build Environment.

EDIT: When you run one of these shortcuts, you then have to run the Visual Studio 2008 IDE directly from the command prompt started by the shortcut, since the environment variable settings are not persisted by the shortcut. This should be done like so (using whatever path you have VS2008 set up in):

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE>devenv

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜