Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reference error while compiling C file in VS2010 command-prompt

I have VS 2010 installed on my system and i was trying to compile a simple hello.c in VS command prompt. The compilation gave an error.

Fatal Error C1083: Cannot open include file: 'stdio.h' no such file, folder exist

Why this error is coming ?? Does VS2010 not include reference files/assemblies for C.

like image 495
Pankaj Upadhyay Avatar asked Aug 26 '11 14:08

Pankaj Upadhyay


1 Answers

VS 2010 certainly does contain the standard headers. You should check that your command prompt environment is set up correctly. There should be an environment variable named INCLUDE that has a directory similar to the cfollowing (among other directories) in it:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE

that directory (the name may vary slightly, for example depending on if your machine is a 64-bit OS of not) should include stdio.h

If you don't have such a directory in your environment, then you're not setting up the environment correctly. You should use on of the "Visual Studio Command Prompt" shortcuts that VS installs, or simply run

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat

With the appropriate parameter to get the environment you want (x86 or amd64 for example).

If the INCLUDE environment variable does have an entry like that, but the stdio.h file doesn't exist, then you might need to reinstall VS.

like image 192
Michael Burr Avatar answered Sep 23 '22 02:09

Michael Burr