Windows.h missing ?

Started by
10 comments, last by AndyHarglesis 13 years ago
Hello all,

Today i decided to start programming with DirectX 11, so i downloaded the latest sdk(i had the one from february 2010)
and installed it. I opened an example project and tryed to compile it, but to my suprise i get a compiler error saying that windows.h cannot be found.
Before i installed the latest sdk everything was fine.

btw im using visual studio 2008.

thanks in advance
Advertisement
Are you by any chance #including "Windows.h" instead of <Windows.h> ?

Are you by any chance #including "Windows.h" instead of <Windows.h> ?


Nope im including <Windows.h>
Mabye the installation messed up my settings?
Is it bad to have 3 different versions of the SDK installed?
Because i got the 2007, 2010(february) and 2010(june) versions.

Thanks
Have you got the platform sdk?

Windows.h isn't included in Visual Studio express edition installations so that could be your problem (if you are using the express edition that is).


Have you got the platform sdk?

Windows.h isn't included in Visual Studio express edition installations so that could be your problem (if you are using the express edition that is).




I tryed to install the latest version of the platform SDK,
but it didnt solve my problem.

Edit : Im using the Visual Studio 2008 Professional Edition.

but to my suprise i get a compiler error saying that windows.h cannot be found.
Before i installed the latest sdk everything was fine.


There are known issues with various versions of SDKs being used with various versions of IDEs where they stomp on each other's configured paths.

You can either modify the search paths to use whatever you expected, or download and install the latest Windows SDK, which should again update the search paths and include itself. I suggest you use the latest version of the SDK unless you have a compelling reason not to.

[quote name='Jeffreyp' timestamp='1302808174' post='4798514']
but to my suprise i get a compiler error saying that windows.h cannot be found.
Before i installed the latest sdk everything was fine.


There are known issues with various versions of SDKs being used with various versions of IDEs where they stomp on each other's configured paths.

You can either modify the search paths to use whatever you expected, or download and install the latest Windows SDK, which should again update the search paths and include itself. I suggest you use the latest version of the SDK unless you have a compelling reason not to.
[/quote]

I already got the latest Platform SDK / DirectX SDK, but im using Visual studio proff 2008.
So i have to switch to Visual studio 2010?

btw i tried a repair on visual studio 2008 and it didnt work.

[quote name='frob' timestamp='1302886358' post='4798827']
[quote name='Jeffreyp' timestamp='1302808174' post='4798514']
but to my suprise i get a compiler error saying that windows.h cannot be found.
Before i installed the latest sdk everything was fine.


There are known issues with various versions of SDKs being used with various versions of IDEs where they stomp on each other's configured paths.

You can either modify the search paths to use whatever you expected, or download and install the latest Windows SDK, which should again update the search paths and include itself. I suggest you use the latest version of the SDK unless you have a compelling reason not to.
[/quote]

I already got the latest Platform SDK / DirectX SDK, but im using Visual studio proff 2008.
So i have to switch to Visual studio 2010?

btw i tried a repair on visual studio 2008 and it didnt work.
[/quote]

1.Are you absolutely positive that the <windows.h> file is in your hard drive and existing?

2.Are you sure that all libs, dlls and such related to <windows.h> are existing?

3.Did you check and see because some DirectX headers already include <windows.h> or maybe the compiling is confused by some related issue to that.

4.I can't really be the best judge because I don't use Visual Studio anymore... I use Code::Blocks, Bloodshed Dev, C++ mainly.

5.Is the windows.h file in the directory from which the preprocessor reads from? The file must be in the includes folder of your Visual Studio folder because that's where the #includes/header files and such are read from. Check and see if windows.h is there along with all of its other sub-headers, dlls and lib files.

Any slight error can make the compilation fail if the preprocessor can't find the file because it's misplaced or missing necessary things associated with it to function properly.

The externs, dlls and lib files must be working in full accordance with the main windows header file. If not, then it won't work. But the issue you seem to be having is likely due to the fact that the main windows header file is not in the include folder/directory where the preprocessor reads from.

Thus, "Cannot find <windows.h>. No such file exists.".

Also, not to sound too picky, but everything is case-sensitive. If you capitalize it then it may not work, but that's usually not the case.

Check all spelling to assure perfect syntax and everything in the #include for windows header file as well.

1.Are you absolutely positive that the <windows.h> file is in your hard drive and existing?
[/quote]
Yes, because if i compile it with Dev-C++ it works fine.


2.Are you sure that all libs, dlls and such related to <windows.h> are existing?
[/quote]
Yes, because they existed before too.


3.Did you check and see because some DirectX headers already include <windows.h> or maybe the compiling is confused by some related issue to that.
[/quote]
When i try to compile a simple hello world program it gives the same error. So it isnt DirectX.


4.I can't really be the best judge because I don't use Visual Studio anymore... I use Code::Blocks, Bloodshed Dev, C++ mainly.
[/quote]
On dev c++ it compiles fine.


5.Is the windows.h file in the directory from which the preprocessor reads from? The file must be in the includes folder of your Visual Studio folder because that's where the #includes/header files and such are read from. Check and see if windows.h is there along with all of its other sub-headers, dlls and lib files.
[/quote]
No it isnt there. And after i see im missing alot more headers like <vector>.
So i already tried a repair but it didnt give me the headers back.
I guess its an issue with the compiler working with the SDK?

No it isnt there. And after i see im missing alot more headers like <vector>.
So i already tried a repair but it didnt give me the headers back.
I guess its an issue with the compiler working with the SDK?
[/quote]

If you're missing the header files then that pretty much explains exactly what the problem is.

That IDE didn't bring the header files? Trash it and get another one, specifically a newer one.

That should solve the case. Make sure you completely remove all of the files relating to your current IDE before downloading the newer one.

Try that and tell me how it goes.

But yes, it could also have to do with the compiler. Which one do you use?

All in all, getting a newer IDE or using a different one will solve your problem.

It obviously works on other IDEs because they contain the header files, libs and all other necessary files to run the Windows API.

The IDE you were failing to get it running on was missing the files.

Hence, use another IDE with all of the optimum Windows files for the Windows API language and environment because getting all the files together yourself, one by one, will be a pain and there will likely be countless errors.

Logic number one: If you want to use something and it doesn't exist then you can't use it.

Research and re-learn.

This topic is closed to new replies.

Advertisement