-2

I wanted to run C programs on windows in order to achieve this I downloaded cygwin(Linux like environment for windows) made a program and kept it on a directory called ..\cygwin\home\Computer

Code goes here

#include<iostream.h>
void main(){
printf("Hai");
}

When i am trying to execute this program using command prompt. $ g++ hai.c Its throwing out an error

hai.c:1:21: fatal error: iostream.h: No such file or directory
 #include<iostream.h>
                     ^
compilation terminated.

What is going on any idea?

arunwebber
  • 91
  • 13

1 Answers1

2

change to

#include <iostream>
#include <cstdio>
int main(){
    printf("Hai");
}

or with g++ -x c hai.c or gcc hai.c

#include <stdio.h>
int main(){
    printf("Hai");
}
BLUEPIXY
  • 39,699
  • 7
  • 33
  • 70