views:

73

answers:

2

Visual Studio drives me crazy and I am suspecting I am doing something wrong.

This is what I do: I installed Visual Studio (Pro '08) a long time ago, I installed the Windows SDK (Win 7 x64), someone emails me a project, it fails to build.

Invariably, it can not find windows.h. While it is easy enough to include C:\Program Files\Microsoft SDKs\Windows\v7.0\Include in the project settings of every single project, I feel that this may not be the proper way to do it. Is there a way to somehow make Visual Studio globally aware of these files?
I also tried to include the above directory in the path variable but that didn't change anything.

Also, it will randomly find windows.h but not winresrc.h in the same directory.

Edit:
It was a problem with my machine. Somehow, Visual Studio thought that my Windows SDK was in the wrong place. See accepted answer and comments for the fix.

+3  A: 

You can set Visual Studio's global include path here:

Tools / Options / Projects and Settings / VC++ Directories / Include files

RichieHindle
It lists `$(WindowsSdkDir)\include`, so I guess that `$(WindowsSdkDir)` is wrong. How can I check or change it?
BastiBechtold
It references a registry key `CurrentInstallFolder` in `HKEY_CURRENT_USER\Software\Microsoft\Microsoft SDKs\Windows`, which lists a nonexistent directory. Fixing that fixed my problem.
BastiBechtold
@Paperflyer: Right-click My Computer and choose Properties (or choose System from Control Panel). From the Advanced tab, select Environment Variables. There you can set your user and system-wide environment variables, like $(WindowsSdkDir).
Adrian McCarthy
I know path is there but there is no entry there for WindowsSkdDir
BastiBechtold
A: 

You need to make sure and have the following:

#include <windows.h>

and not this:

#include "windows.h"

If that's not the problem, then check RichieHindle's response.

280Z28
no, that's not the problem
BastiBechtold