0
#include<stdio.h>
  main()
  {
     int num1,num2,sum;
     printf("Enter the two integers to be added");
     scanf("%d %d", &num1, &num2);
     sum = num1+num2;
     printf("Addition of %d and %d = %d", num1, num2, sum);
  }

The errors I get are:

  1. Unable to open include file 'stdio.h'

  2. Function printf should have a prototype.

  3. Function scanf should have a prototype.

Community
  • 1
  • 1
TNT
  • 9
  • 1
    can be a problem with your installation. Check if the file stdio.h is present in the directory.If not Get the file form the link – Sourav Kanta Jun 04 '15 at 03:30
  • Not directly related to the question, but the `main` has to be defined as `int main()` or `int main(int argc, char **argv)`. – SU3 Jun 04 '15 at 03:30
  • 4
    which compiler are you using? – GabrielOshiro Jun 04 '15 at 03:31
  • 1
    How are you compiling? – Gopi Jun 04 '15 at 03:32
  • 1
    possible duplicate of [How to fix "unable to open stdio.h in Turbo C" error?](http://stackoverflow.com/questions/2356687/how-to-fix-unable-to-open-stdio-h-in-turbo-c-error) – WedaPashi Jun 04 '15 at 03:41
  • 1
    The big problem here is that the preprocessor cannot find stdio.h. On unix systems (Linux, *BSD, Solaris, etc), the file is usually located in /usr/include. As someone pointed out, this may be a problem with your installation. Check your include paths and make sure that everything is on it that should be on it. The other two errors are generally warnings and are a result of a missing stdio.h file. – Daniel Rudy Jun 04 '15 at 03:55
  • Like everybody else has pointed out: `Unable to open include file 'stdio.h'` definitely sounds like an install problem. Re-install, and try again. If it *still* doesn't work, please post back 1) which compiler you're using (MSVS? GCC? "Something else"?), 2) which platform you're running (DOS? Linux? Mac? "something else"?), and 3) how you're compiling (from a command line? An IDE?) – paulsm4 Jun 04 '15 at 04:01
  • 1
    PS: "get stdio.h from the link" is *BAD ADVICE*. I would *NOT* download a copy of "stdio.h" from MinGW, for example, and expect it to work with MSVS. "stdio.h" should absolutely come installed with the specific compiler - and compiler version - you're actually using. – paulsm4 Jun 04 '15 at 04:03

1 Answers1

2

Make sure that you have installed the c compiler properly. If you are on linux OS then it comes pre-installed.

Achyuta Aich
  • 569
  • 1
  • 5
  • 13
  • There is no such single thing as "linux OS", and indeed many Linux distributions do not install a compiler by default. –  Jul 17 '15 at 23:41