简体   繁体   中英

Visual studio 2015 can't compile even Hello World program

I tried to run this simple Hello world example:

#include <iostream>
using namespace std;
int main()
{
    cout << "Hello world" << endl;
    return 0;
}

But VS returned the following error:

c:\\program files (x86)\\microsoft visual studio 14.0\\vc\\include\\corecrt.h(2): fatal error C1083: cannot open file corecrt.h: No such file or directory

After some googling I found possible solution. It was said to add the following values to project -> properties -> AdditionalIncludeDirectories and AdditionalLibraries:

$(UniversalCRT_IncludePath)
$(UniversalCRT_LibraryPath_x86)

When I did that nothing happend. VS returned the same error.

How do I correct that?

It could be a number of different factors - it is dependent on how you created the project.

Regardless, you can determine if your build paths are correct by checking the following:

(Solution Explorer) : Click on your project, and then select the Project Properties. From there, check the VC++ Directories page, and look at your Include Directories.

在此输入图像描述 It should contain $(VC_IncludePath); and $(WindowsSDK_IncludePath);. If it contains these, edit the Include Directories, and select the MACRO button so you can see the actual paths in use for your build tools.

在此输入图像描述

Chances are one of them is incorrect.

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM