Microsoft Visual Studio Community 2019: fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory - c++

Just completed the fresh installation of Microsoft Visual Studio Community 2019 with no optional features,
tried running simple code with c++ console app project type:
#include <iostream>
using namespace std;
int main()
{
cout << "testing vs 2019" << endl;
return 0;
}
Getting below error:
1>------ Rebuild All started: Project: Project1, Configuration: Debug x64 ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(434,5): warning MSB8003: The WindowsSDKDir property is not defined. Some build tools may not be found.
1>Source.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include\crtdefs.h(10,10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory
1>Done building project "Project1.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

I suggest you should download and install the Windows 10 SDK in the VS2019 installer.
The selected version needs to be the same as the version set in the project.

install the universal CRT SDK - refer the article here Universal-crt

Related

Unreal engine 4.26.2 source version errors when running

I'm trying to set up UE4.26.2 source version but haven't been successful. I have cloned the repo from github, ran Setup and GenerateProjectFiles without errors, set development editor and x64 in Visual studio 2019 and built it without errors but when I try to run the UE I always get the same two errors:
Build started...
1>------ Build started: Project: UE4, Configuration: Development_Editor x64 ------
1>Building UE4Editor and ShaderCompileWorker...
1>Using Visual Studio 2019 14.34.31937 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933) and Windows 10.0.20348.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>Building 2 actions with 16 processes...
1> [1/2] UE4Editor.exe
1>LINK : fatal error LNK1104: cannot open file 'D:\UE4.26.2\UnrealEngine-4.26.2-release\Engine\Binaries\Win64\UE4Editor.exe'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(45,5): error MSB3073: The command "..\..\Build\BatchFiles\Build.bat -Target="UE4Editor Win64 Development" -Target="ShaderCompileWorker Win64 Development -Quiet" -WaitMutex -FromMsBuild" exited with code 6.
1>Done building project "UE4.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========
LNK1104 cannot open file 'D:\UE4.26.2\UnrealEngine-4.26.2-release\Engine\Binaries\Win64\UE4Editor.exe'
MSB3073 The command "....\Build\BatchFiles\Build.bat -Target="UE4Editor Win64 Development" -Target="ShaderCompileWorker Win64 Development -Quiet" -WaitMutex -FromMsBuild" exited with code 6.
I have tried various different combinations of VS components, I have installed .net Desktop dev, desktop dev with c++ and game dev with c++. I am using .NET Framework 4.8 SDK with all the previous 4.x targeting packs. I have tried deleting certain content from the Win64 folder and other files which I can't recall, but after I run the UE4 it always builds them again so the errors persist.
I solved the issue. My avast antivirus put the "UE4Editor.exe" into quarantine, then I restored it and compiled and voila, it works

Cannot build console application with Microsoft Visual Studio 2019

I just installed the community version of VS 2019. I selected to build a console application that it created for me ("hello world" program). The file created is called ConsoleApplication1.cpp. I went to the build menu, selected build, and get the following error:
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(441,5): warning MSB8003: The WindowsSDKDir property is not defined. Some build tools may not be found.
1>ConsoleApplication1.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\yvals.h(12,10): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
1>Done building project "ConsoleApplication1.vcxproj" -- FAILED.
I tried to follow directions listed elsewhere on stackexchange. When I select "Project -> Properties" the Windows SDK field is blank. A value I typed in from the other StackExchange message creates an error that that version of the SDK cannot be found. So I deleted the version of the SDK and made it blank again. I also tried using "10.0" Here is where I received the advice:
Visual Studio 2017 errors on standard headers
Perhaps I did not install all the needed components. I recently checked off: "Windows Universal CRT SDK" (as per the instructions), but the build still fails. The warning is interesting. I looked that up also but have not found a solution that works. My "Platform Toolset" is Visual Studio 2019 (v142).
What might still be missing to build a console application? Thank you. I am working on Windows 7.

WinRT auto generated template compiling error in Visual Studio 2017

I am new to c++/WinRT. I am trying to create a new blank project under c++/WinRT using Visual Studio Pro 2017. But it gives some compiling error:
1>------ Build started: Project: BlankApp2, Configuration: Debug Win32 ------
1>Windows.AI.MachineLearning.MachineLearningContract.winmd
1>C:\Program Files (x86)\Windows Kits\10\References\10.0.17763.0\Windows.AI.MachineLearning.MachineLearningContract\1.0.0.0\Windows.AI.MachineLearning.MachineLearningContract.winmd : warning C4335: Mac file format detected: please convert the source file to either DOS or UNIX format
1>C:\Program Files (x86)\Windows Kits\10\References\10.0.17763.0\Windows.AI.MachineLearning.MachineLearningContract\1.0.0.0\Windows.AI.MachineLearning.MachineLearningContract.winmd(1): fatal error C1004: unexpected end-of-file found
1>midlrt : command line error MIDL1003: error returned by the C preprocessor (2)
1>Done building project "BlankApp2.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I updated my Visual Studio 2017 to the latest version. I also used the latest WinRT. I could build a console application using the code in Kenny Kerr's command window sample code. But couldn't build the blank application created by the Visual Studio 2017 wizard. Any help is greatly appreciated.

LINK : fatal error LNK1104: cannot open file 'ucrtd.lib' in VS2017 RC

I keep getting an error when I build a C++ project in Visual Studio 2017 RC.
1>------ Build started: Project: test, Configuration: Debug x64 ------
1>Source.cpp
1>LINK : fatal error LNK1104: cannot open file 'ucrtd.lib'
1>Done building project "test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
OS: Windows 8.1, Visual Studio 2017 Release Candidate
Here is my program:
int main()
{
}
I did not set the language to anything special
I searched my whole machine for the file., but could not find it.
I have installed Windows SDK 8.1
Update:
After the comment from #user1336087
I tried to install Windows SDK 10I get an error:
[14f0:0009][2016-11-23T09:22:20] Package 'Win10SDK_10.0.14393.33,version=10.0.14393.3300' failed to install. Command executed: "C:\ProgramData\Microsoft\VisualStudio\Packages\Win10SDK_10.0.14393.33,version=10.0.14393.3300\packages\Win10SDK\10.0.14393.33\sdksetup.exe" /features OptionId.WindowsSoftwareDevelopmentKit OptionId.WindowsSoftwareLogoToolkit OptionId.NetFxSoftwareDevelopmentKit /quiet /norestart, Return code: -2146889721, Details: The hash value is not correct.
A workaround seems to have been described here: link
But the workaround still fails, even when I uninstall all SDK and install again.
It works in the final version of Visual Studio 2017
This comment here helped me with the same error. It seems having old versions of the Windows SDK present can cause LINK to get confused. Deleting the old version I had fixed the problem.
https://community.intel.com/t5/Intel-Fortran-Compiler/LINK-fatal-error-LNK1104-cannot-open-file-ucrtd-lib-with-VS2015/td-p/1060422

Marmalade ErrorCode 4 while building mkb project

I've got a project from my teacher, that I should run in the Marmalade Hub. I've imported this project en tried to run it. At first I got an error with the error code 7.
error: Visual Studio 2013 Express Windows Desktop requested but not found instal
led.
FAILED (error code=7)
I've fixed this problem to change the C++ Development (IDE's and Compilers) from 'Visual studio Express 2013 Windows Desktop' to 'Visual Studio 2013' (see image below). I did this change, because I do have 'Visual Studio Proffesional 2013 for Windows Desktop' and not 'Visual Studio Express 2013 for Windows Desktop'. 'Visual Studio 2013 Proffesional 2013 for Windows Desktop' doesn't exist in the drop down.
I tried again to run the project (see image below) and I did get another error with the error code 4:
-- Visual Studio Output --
1>------ Build started: Project: minimal_marmalade_vc12, Configuration: x86 Debu
g Win32 ------
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/FORCE' specification
1>LINK : fatal error LNK1181: cannot open input file 'cgl_d.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
-- End Visual Studio Output --
error: build failed: '['C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\C
ommon7\\IDE\\devenv.exe', 'minimal_marmalade_vc12.sln', '/build', 'X86 Debug', '
/out', 'vs_output_11728.log']' (1)
FAILED (error code=4)
I hope you guys (or girls ;) ) can solve this problem. Thanks!
Maybe that your project uses the library Core Media Library. Check whether used somewhere in the code header file cgl.h If so, then reinstall Core Media Library Instalation instructions you find in this guide