Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.0\VC\include directory. There is no stdio.h or stdafx.h . I really am not sure why. How can I get them back?

like image 989
Harpo Avatar asked Jul 31 '15 00:07

Harpo


1 Answers

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 Kits\10\Lib\10.0.10150.0\ucrt\(Choose your architecture)

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

C:\Program Files (x86)\Windows Kits\10\Include\10.0.10150.0\ucrt 

Note: The 10.0.10150.0 may vary depending on your version.

like image 171
Cezar Azevedo de Faveri Avatar answered Dec 06 '22 14:12

Cezar Azevedo de Faveri