1

Hello and thanks for your help. I recently downloaded some source files in C++. They build a DLL for managing a camera. Anyway, when opening with Visual Studio 2015, it notifies me there will be some conversion because the compiler has changed. After that there are red lines under

#include <windows.h>
#include <WType.h>

passing the mouse over them it says "cannot open source file ..."

Now, I ve googled this error and found some resources, even in this very same site. However their solutions don't work. Sometimes the OP just say "Oh it worked thanks!" but does not specify what makes it work.

So I am asking for some help here. What is this error and how can I solve it? (I am supposing it involves some settings in the project)

Thanks again for all the help

(p.S. I have the dlls provided by the writer but would like to build the project myself)

Edit: When building the output messages are

    1>------ Build started: Project: DirectShowFacade, Configuration: Debug Win32 ------
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\PlatformToolsets\v140_xp\Toolset.targets(36,5): warning MSB8003: Could not find WindowsSdkDir_71A variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>  DirectShowFacade.cpp
1>d:\xxxxxxxxxxxxxxxx\cameraprogramming\directshowfacadesources\directshowfacade.h(28): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
KansaiRobot
  • 7,564
  • 11
  • 71
  • 150
  • What's the exact value of "Configuration Properties -> General -> Platform toolset"? Try changing it to "Visual Studio 2015 - Windows XP" – Anton Malyshev Sep 20 '16 at 03:24
  • Thanks for the reply. Already did. Error still there. – KansaiRobot Sep 20 '16 at 04:32
  • can your visual studio compile a simple cpp file that includes those? If not then something is probably not configured correctly (or possibly you need to install the SDK, but windows.h should come with the compiler I'd imagine...I wonder if when you imported the project it came in with some bad paths or something) See also http://stackoverflow.com/questions/12748896/cannot-open-windows-h?rq=1 – rogerdpack Sep 20 '16 at 04:45
  • When I create a simple winform application and import those there is no problem at all. – KansaiRobot Sep 20 '16 at 04:46
  • The code original platform set was v120_xp. It got converted to v140_xp – KansaiRobot Sep 20 '16 at 04:47
  • Nothing in the warning/error message indicates, that your header files can't be opened. You may want to start by reading error messages more carefully. It explicitly spells out, which precondition isn't met. – IInspectable Sep 20 '16 at 08:22
  • Sorry, I don't understand what you are saying. In the error message the last line indicates that the header files can not open, explicitly. – KansaiRobot Sep 21 '16 at 00:21
  • The final error is just a consequence of the previous warning. Fix the warning, and the error goes away. – IInspectable Sep 21 '16 at 09:29
  • Possible duplicate of [Visual Studio 2017 can't find windows.h](https://stackoverflow.com/questions/43410631/visual-studio-2017-cant-find-windows-h) – Stevoisiak Jul 06 '18 at 15:20

1 Answers1

4

Properties → General → Target Platform Version → change to 8.1

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291