can't setup openGL superBible examples due to problems finding Windows.h - c++

I'm trying to compile the examples from the book OpenGL SuperBible 6th edition.
I got everything from their git repository and I'm trying to open it using Visual studio 2013 by opening the visual studio 2013 solution file that is included.
When I try building the main project inside "sb6_vs2013" It claims it can't find Windows.h : "Error 2 error C1083: Cannot open include file: 'windows.h': No such file or directory"
Now I tried to look at people's solutions on the internet and couldn't find anything helpful.
If I right click on the project and go to properties -> Configuration Properties - > VC directories I can see that it has the line:
$(WindowsSdkDir)\include
When I click on Macros I can see the path of WindowsSdkDir, its pointing to the right place where Windows SDK is, which in my case is: "C:\Program Files (x86)\Windows Kits\8.1" if I look at my file system in that folder and go to "\Include\um\" I can find Windows.h there, but for some reason visual studio 2013 fails to find it.
I thought it was due to bad installation and I even went as far as re-installing windows, visual studio and everything (it was time for that anyway) but nothing seems to fix this problem, even the new fresh installation didn't do the trick.
I'm not sure what else I can do to make this work.
Could someone help me solve this issue once and for all?

Eventually I managed to solved it, after the reinstall all the macros were correct I just need to check "inherit from parent on project defaults" checkbox and it did the trick

Related

Cannot open source file in a CMake Project in Visual Studio

I have a C++ Project in Visual Studio 2022 (Windows 11) that is put together using CMake. I understand that the difference here is, that my project is not a Solution but rather just folders with code and the CMake tells it how to compile it?
But my problem is, that it doesn't seem to find C's standard libraries and shows error "cannot open sourcefile".
Screenshot
The error is definitely not in the project, since it runs just fine on my laptop, just not on the PC I want it to run on.
How can I tell it where these libraries are? Where are they located even?
Any help would be greatly appreciated and I can share more files on request.
Things I have tried:
Going to properties and choose the correct Windows SDK Version - The properties are empty
Comparing every variable of the CMake Settings with the ones on my laptop where it works
completely reinstalling Visual Studio (yes I did that)
looking through lots of StackOverflow questions but none of them describe my problem

Having trouble with setting up C++ in Visual Studio

I'm getting a common error on the issue that I'm having but nothing has worked:
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\yvals.h(12,10): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
I've been told to download the C++ dev kit again, the Windows SDK again, Reset my PC after download and manually change the path inside the file that can't find it.
As it turns out the file exists (and the Windows SDK too, I assume), Visual studio is just looking for it in the wrong spot, So I figure this is a setup issue. It exists in this location C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt. You could say why not just manually link to it? I have but then another file can't be found, so I change that and then another one can't be found and so on. I'd appreciate the help as this is the reason I get scared to use Visual Studio and go back running to Code, thank you!
Does this issue also occur if I create an empty C++ project and build it? If it works fine, this issue is more relevant to your current project.
Please check the target platform version of your project. Right click the project name and select ‘Properties’—‘Configuration Properties’—‘General’— ‘Windows SDK Version’ like the following, and select the Windows 10 SDK to have a try.
You could also refer to the method in this issue.
(PS:You need to make sure that the SDK you install is consistent with the operating system, for example if you use Win 11 then you should install the Windows 11 SDK.)

visual studio unable to find assert.h

I'm a first year at uni and I just got my new laptop. I downloaded Visual Studio 2017 and pulled my solution repo. However, I'm having some issues because it appears that a lot of the files I had on my previous computer were not downloaded in the installation of VS. My university wifi is slow and I don't want to re-download if I don't have to. I followed the previous steps I took to download VS 2017 on my old computer. Yet, I'm getting errors like:
cannot open source file "assert.h"
cannot open source file "errno.h"
cannot open source file "float.h"
cannot open source file "corecrt.h"
cannot open source file "stddef.h"
cannot open source file "stdio.h"
(among 20+ others)
If I right-click and choose the "Open document" on the line with the error, I get the message:
File '_______.h' not found in current source file's directory or in build system path
However, if I go to my include paths, I can find files like:
cassert.h
cerrno.h
ostream.h
but none of the ones that I'm told are missing.
Mainly, I'm wondering if there is a directory with this files I just need to add to the include directory or whether I just need to admit defeat and reinstall.
Thanks for the help, I welcome editing as I'm sure I've messed things up. I'm new to this.
Cheers,
Caleb
Using VS2017 I was able to resolve this same issue by:
Right click on solution
Selecting 'Retarget Solution'
Selecting an SDK from the Windows SDK Version dropdown
Clicking OK button
Your Visual Studio 2017 installation is probably missing the C packages (they are not automatically included with the Desktop development with C++ workload).
To install it, start the Visual Studio Installer, go to Individual components, and check Windows Universal C Runtime:
I think this component is also automatically marked for installation when adding the Linux development with C++ workload.
I solved the problem by uninstalling my original installation of Visual Studio (2019 version), then reinstalling and including the workload Desktop Development with C++.
In contrast to the above solutions, I did not need (and it did not help) to add the Windows Universal C Runtime.

VS 2017: fatal error RC1015: cannot open include file 'winres.h'

I just downloaded Visual Studio 2017 and converted my dialog-based C++/MFC project with it (from Visual Studio 2008 SP1.) But then when I go to Resources it shows this error:
fatal error RC1015: cannot open include file 'winres.h'
And idea how to fix this?
I just also came across this issue. It seems my friend missed to push some VS 2017 meta file to the server. My quick solution is to change the Windows SDK version to match the Windows 10 OS version or below.
You can check your OS version from the cmd tool.
Jeff T. answer is great if you have a single project.
If you have many projects in which you have to change the target Windows SDK (or if you want to make sure they all match), you'll probably prefer to use the Retarget Solution button found when right clicking on the solution:
Then just select some Windows SDK version that you have installed, and apply it to all (or whatever) projects you need to change:
That list of Windows SDK versions will probably show some that don't really work. You might have to try.
The missing files are located in two directories:
C:\Program Files\Windows Kits\10\Include\10.0.15063.0\um
C:\Program Files\Windows Kits\10\Include\10.0.15063.0\shared
Add the two paths to project properties (Project >> ...Properties >> Configuration Properties >> VC++ Directories >> Include Directories).
You should install the framework MFC
For anyone who stumbles onto this question is in the same boat as me (tried all of the above with no luck)..
I just created a fresh project and created a resource immediately (no issue) and then went ahead and readded all the code / libs that were needed. A bit annoying but I'm sure it was a mistake I made while configuring the project settings
Hopefully this helps someone out
I my case, it was caused by wrong project configuration. Specifically Property Pages -> VC++ Directories -> Include Directories and there check Inherit from parent or project defaults.
Probably VS2017 fatal error RC1015 when attempting to add a new resource. fellow also got this error with VS2017.

Can't Build PortAudio - "LNK1104: cannot open file 'ksguid.lib'"

I'm a beginner in C/C++, so please bear with me.
I'm trying to build the PortAudio library so I can use it in one of my project. I'm using VS 2013, the preset project-file for builds had to be converted to my version. I've been able to fix all the many problems that occurred on my long way here, except one:
LINK : fatal error LNK1104: cannot open file 'ksguid.lib'
I've seen this and this site. All of them address exactly this problem, yet non of them has been able to solve it. Here are the solutions these sites suggest:
Add WASAPI - symbol to portaudio.def,
Add PA_WDMKS_NO_KSGUID_LIB - definition to the preprocessor
You can get the ksguid.lib-file from the Windows 7 SDK. It might even already be installed on your computer. It's best to use the explorer to find it (probably C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64).
When you found it, go back to Visual Studio and go to Project > Properties > Configuration-Properties > Linker > Input, then click on the little arrow on the right of Additional Dependencies and choose edit:
Enter the absolute filepath to ksguid.lib. Make sure that you surrounded it with "-s and that you put a ; at the end. (Throws an error without a usable description otherwise - Microsoft as we know it.)
Source: Bitbucket, stackoverflow
ksguid.lib is included in the Windows 7, 8, 8.1, and windows 10 sdk. The answer provided by #Nearoo is perfectly valid. This alternative answer involves modifying what directories the portaudio Visual Studio project looks for library files.
For reference, I'm using Visual Studio 2013 on a Windows 8.1 PC.
Navigate to: Project -> Properties -> VC++ Directories
At the top of the window,
change Configuration to "All Configurations".
change Platform to "All Platforms"
In the "Library Directories" portion, add the following path:
$(WindowsSdkDir)\Lib\winv6.3\km\$(PlatformTarget)\
This nice thing is that this one path uses macros so it will work with Debug, Release, 32 bit and 64 bit builds of portaudio.