vcruntime.h missing from Windows include folder? - c++

I'm a beginner and I'm trying to build an open source project for the first time in Windows, but I keep running into file not found errors when building. What I've found so far is that a header file called corecrt.h is located at C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\. This file would include another header file named vcruntime.h. The problem is that vcruntime.h is nowhere to be found in that folder.
I later found that vcruntime.h is located in a separate folder located at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include. This is strange because I'm not sure why corecrt.h would include a file that is not in its own filepath...
I did the bone-headed thing of just copying over vcruntime.h file to the C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\, but this just shifts the problem down the road because vcruntime.h in turn also includes other header files located at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include, and so on.
I think the issue lies with Windows itself. I think I'm missing something that's suppose to install additional header files like vcruntime.h to C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\
So far I've tried uninstalling/reinstalling Windows SDK, and just reinstall Windows as a whole, but still no dice to make the missing files appear in that folder. Can someone give me some insight on this? I've asked this question on Reddit but so far nothing has been able to help.
Here's the link to the instructions I'm following on how to build https://wiki.documentfoundation.org/Development/BuildingOnWindows
I'm building using their suggested environment Lode on my Windows 10 machine.
I get C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h(10): error: vcruntime.h: No such file or directory
The error occurs right at the build step and I run make 2>&1 | tee build.log

I too had the same issue, but found the cause which was the Include directories were not specified correctly. To fix this I did the following with Visual Studio:
Right click on the project name, and then click on Properties.
Under Configuration Properties, select VC++ Directories.
The Include directories should contain $(VC_IncludePath);$(WindowsSDK_IncludePath); - correct this.
Click OK to save and Bob's your uncle.

Related

Cannot open include file: 'stddef.h': No such file or directory in cstddef QtCreator

When I want to compile my Qt project, debuger shows me that stddef.h was not included into ...\VC\Tools\MSVC\14.27.29110\include. I tried to solve this problem using adding to system Environmental Variables path to Win SDK Kits (folder include). But this doesnt solve my problem. Also I instaled Windows Universal CRT SDK but this giving me nothing. Also I tried to reinstall VS and Qt,check Qt for update, add to environment variable PATH path to folder bin from MSVC folders and change include in cstddef from stddef.h to stddef. This is the list of my environment variable PATH:
C:\Program Files\Microsoft SQL Server\130\Tools\Binn\
C:\Program Files\dotnet\
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0
And this is user environment setting PATH:
C:\Users\karat\AppData\Local\Programs\Python\Python37-32\Scripts\
C:\Users\karat\AppData\Local\Programs\Python\Python37-32\
C:\Users\karat\AppData\Local\Microsoft\WindowsApps
C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.1\bin
C:\Users\karat.dotnet\tools
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps
%USERPROFILE%.dotnet\tools
Could you recommend me a way to solve this problem and tell me why this could happen at all?

"Cannot open source file" for header files of installed SDK

I am trying to continue to work on a C++ project that somebody else started. To open the project, I had to install the C/C++ workload; I did that and already restarted my PC.
The project originally targeted a different Windows SDK version than the one that is installed on my PC. This lead to Visual Studio IntelliSense telling me "Cannot open source file" for SDK header files like stdio.h or string.h for example.
I went to the project settings > VC++ Directories > Include Directories > Edit and saw that the variables expanded to the wrong paths. Thus I proceeded to retarget the project to the Windows SDK version that is currently installed on my PC (10.0.17763.0).
Now, if I check the Include Directories, I see that "Inherit from parent or project defaults" is checked, the inherited value is
$(VC_IncludePath)
$(WindowsSDK_IncludePath)
and that this expands to
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\include
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\VS\include
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\cppwinrt
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um
I checked that all of these directories do exist on my machine.
However, VS keeps telling me that it cannot open the source files, even after cleaning and rebuilding the whole solution. The project seems to compile, but the code is all squiggly.
My includes are:
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <float.h>
#include <string.h>
#include <stdarg.h>
#include <limits.h>
#include <locale.h>
#include "svm.h"
Only stdarg.h, limits.h (both from C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\) and svm.h (in project) work. All other includes have this error; they all come from the directory C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt, I can find all of them in that directory.
I noticed that when I type #include < and let IntelliSense suggest includes, it also does not suggest those from any of the C:\Program Files (x86)\Windows Kits\10\ subdirectories. These header files are listed in the "External Dependencies" project node though.
StackOverflow is full of questions about this error, but usually about a third party lib or project file, and the answers suggest to check the Include Directories. I did that, and they appear to be complete if I can trust the expanded value, but apparently something is still wrong.
I am basically new to C++ and all the "header magic", so it might be related to the project. I found that the project contains some "stdafx.h" file (which is as I read for precompiled headers), however the project settings say to not use precompiled headers and indeed I cannot see any *.pch file either.
Encouraged by Ted Lyngmo's comment I started to edit one of the imports, when suddenly all errors disappeared and the problem was resolved, although nothing had changed.
I had done that before and it didn't help then, so unfortunately I don't know why it helped the second time. As unsatisfactory as it is - it seems that this was a caching issue after all that even persisted after clean and rebuild.
Maybe the difference was that the second time I edited was after the clean and rebuild of the solution, but I can't guarantee.
I'm not very happy with this outcome, because I would've liked to understand what helped and why, but in the end this solved the problem. So it seems you have to retarget, then clean, then rebuild, maybe restart VS, and edit some imports to force whichever cache there is to be invalidated.
P.S.: Also, in the mean time, go and participate in StackOverflow. Apparently this helps. Thus I'm marking this as community answer.

jvm.dll is missing from your computer

I have Visual Studio C++ Project, which has to call some java functionality. I'm going to use JNI. I have specified additional include directories:
C:\Program Files (x86)\Java\jdk1.7.0_10\include
C:\Program Files (x86)\Java\jdk1.7.0_10\include\win32
and additional library directory
C:\Program Files (x86)\Java\jdk1.7.0_10\lib
and was able to compile needed code. But I still cannot run it because of the next error:
The program can't start because jvm.dll is missing...
Anyone help please that what i should do now...?? Is there any way to specify the path for JVM.DLL ???

Multiple relative parent directories in visual studio project settings

I often find that I have problems getting visual studio to find my headers and I think I might have finally found out why: it seems that visual studio does not understand multiple relative directories in project configurations, e.g:
When that directory certainly does exist.
My question is: can somebody confirm this is the case and, if so, is there a reason why they'd do this? Is it a bug or intentional?
Posting as an answer as I can't really fit this into a comment although its a bit frowned upon...
The easiest way to debug this is to run Process Monitor from here, and add a filter to only show access to your file name. I made an example c++ project which tried to load a non existant header #include "Bobby.h" and then added the following filter to Process Monitor:
Path Contains Bobby.h Include
Then I ran the build and got the following output:
CreateFile C:\Users\MyUserName\Documents\Visual Studio 2012\Projects\ConsoleApplication2\ConsoleApplication2\Bobby.h NAME NOT FOUND
CreateFile C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\Bobby.h NAME NOT FOUND
CreateFile C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include\Bobby.h NAME NOT FOUND
CreateFile C:\Program Files (x86)\Windows Kits\8.0\Include\um\Bobby.h NAME NOT FOUND
CreateFile C:\Program Files (x86)\Windows Kits\8.0\Include\shared\Bobby.h NAME NOT FOUND
CreateFile C:\Program Files (x86)\Windows Kits\8.0\Include\WinRT\Bobby.h NAME NOT FOUND
From this output you can easily see where the compiler searched for the header file - It may be good enough to help you understand why it didn't find it.
HTH

not your average Cannot open include file: 'D3DX10.h': No such file or directory

Before you try to link me to some other question, please read everything. I am getting this error but I have everything set up correctly. It's not my first time with c++. i am a moderate user and have never had this issue before nor am I having it with any of my other projects.
I'll start off my saying that the file, "D3DX10.h", does exist in "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include".
The "DXSDK_DIR" system variable points to "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\".
My Include Directories for the project for all configurations includes "$(DXSDK_DIR)Include".
Now when I try #include <D3DX10.h>, I get "error C1083: Cannot open include file: 'D3DX10.h': No such file or directory" but when i try '#include "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include/D3DX10.h"', it does infact build and runs with no errors.
Has anyone ran accross this issue and is there anyway to fix it?
Again, please keep in mind that i have other projects that get "D3DX10.h" using the system variable. That is not the issue here.
ha! I got it! It's the parent project that needs to also have the environment variables defined most likely because my library uses some variables directly from D3DX10.h.