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
276 views
in Technique[技术] by (71.8m points)

c++ - Visual studio 2015 gives me errors upon creating a simple test console program

Here is the code I am using.

#include "stdafx.h"
#include <iostream>

int main() {
    std::cout << "hi";

    return 0;
}

When I create simple c++ console application and try to build it, this error occurs:

cannot open include file 'stdio.h': No such file or directory

Why? Shouldn't stdio.h be included as a standard library? What can I do to get it back?

edit: I have just looked into C:Program Files (x86)Microsoft Visual Studio 14.0VCinclude directory. There is no stdio.h or stdafx.h . I really am not sure why. How can I get them back?

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

That's because Visual studio changed the path to C headers.

There you have the info about that: https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/

What i did to solve this is:

Go to Project->Properties->. In Configuraton Properties->VC++ Diretories->Library Directories add a path to C:Program Files (x86)Windows Kits10Lib10.0.10150.0ucrt(Choose your architecture)

And in C/C++->General->Additional include directories add a path to:

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

Note: The 10.0.10150.0 may vary depending on your version.


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

...