arunwebber arunwebber - 3 months ago 8
C Question

Cygwin showing error iostream.h is unable to locate

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?

Answer

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");
}