Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
863 views
in Technique[技术] by (71.8m points)

visual studio 2015 - Cannot find corecrt.h: $(UniversalCRT_IncludePath) is wrong

I've just installed Visual Studio 2015 on my working laptop with Windows 10.

I've cloned a repository with a solution created with the same version of Visual Studio (update 3) on another PC, always with windows 10.

When I try to build the solution on my laptop I obtain the following error:

c:program files (x86)microsoft visual studio 14.0vcincludecrtdefs.h(10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory

In this page I've read that I must add $(UniversalCRT_IncludePath) to my include paths, but even in this case I obtain the same error.

I've checked and $(UniversalCRT_IncludePath) refers to this path:

C:Program Files (x86)Windows Kits10Include10.0.10240.0ucrt

This path is missing on my laptop. Instead I've this one:

C:Program Files (x86)Windows Kits10Include10.0.10150.0ucrt

So it seems that window version is different. Probably this is true, because on my laptop I didn't installed the 1511 windows updgrade, while in the other pc is all installed correctly.

My question is how can I refer to corecrt.h file in both pc without make a mess with paths. I'd like to avoid to hard-link these path because they are pc dependent. and I don't understand why in my laptop the path is wrong considering that it should be system dependent and not cabled into solution.

How can I solve this issue? I know that I can update my laptop to the same windows version but I'd like to avoid it for many reasons.

-- EDIT

I've noticed that that I have this path:

C:Program Files (x86)Windows Kits8.1Include10.0.10240.0ucrt

It has the same 10.0.10240.0 version but related to another windows kit version, so maybe there's some problem in this case. On my laptop I've also Visual Studio 2013, so maybe it can came from it, but I cannot remove it because I'm maintaining another project with Visual Studio 2013 and I cannot remove it yet.

Maybe in Visual Studio 2015 folder I can set explicitly the $(UniversalCRT_IncludePath) in some .bat file (vcvarsall.bat or similiar) but I don't know which file and in which position.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For Visual Studio 2017 I had to:

  1. Run Visual Studio Installer.
  2. Select Modify button.
  3. Go to "Individual Components" tab.
  4. Scroll down to "Compilers, build tools and runtimes".
  5. Tick "Windows Universal CRT SDK".
  6. Install.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...