0

Showing errors wid iostream

I installed code blocks in ma PC and tried to run the hello world programme, but the compiler is showing errors as "fatal error: iostream:no such directory" what shall I do .. help me out please

25th Feb 2017, 7:56 AM
Gopal Krishna Mishra
Gopal Krishna Mishra - avatar
14 Respostas
+ 9
Please post your entire code for inspection.
25th Feb 2017, 8:04 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
type #include <iostream>
25th Feb 2017, 8:00 AM
chris
chris - avatar
+ 3
add a line below #include <iostream> using namespace std;
25th Feb 2017, 8:14 AM
saqib ali
saqib ali - avatar
+ 2
dear try to save your file with extension .cpp instead of .c it will help
25th Feb 2017, 8:05 AM
saqib ali
saqib ali - avatar
+ 2
type using namespace std;
25th Feb 2017, 8:16 AM
chris
chris - avatar
+ 2
every c++ program has using namespace std; its so you can use the std library
25th Feb 2017, 8:18 AM
chris
chris - avatar
+ 1
#include <iostream> if this gives error try #include <iostream.h>
25th Feb 2017, 7:58 AM
saqib ali
saqib ali - avatar
+ 1
it allows you to use standard library containing cin cout endl etc. if you dont use this line you can still use cin cout endl etc but you have to use prefix std:: before them i.e. you have to write std::cout <<"hello world"<<std::endl; and when you use using namespace std cout <<"hello world"<<endl;
25th Feb 2017, 8:21 AM
saqib ali
saqib ali - avatar
+ 1
iostream is a header file that provides input and output services. if you want to use cin and cout you must have it and namespace allows you to use them without adding prefix std::
25th Feb 2017, 8:28 AM
saqib ali
saqib ali - avatar
0
tried iostream.h .. still showing errors.. thanku fr ur concern
25th Feb 2017, 7:59 AM
Gopal Krishna Mishra
Gopal Krishna Mishra - avatar
0
@saqib thnx bro it worked ..but it is again showing other error #include<iostream> int main() { cout<<"hello code blocks"<<endl; cout<<"I can do it"; return 0; } this is my programme !! and it is showing errors tht cout was not declared in this scope endl was not declared in this scope bla bla
25th Feb 2017, 8:11 AM
Gopal Krishna Mishra
Gopal Krishna Mishra - avatar
0
oh yeah it worked @saqib.. but can u please xplain what is the significance of that line
25th Feb 2017, 8:15 AM
Gopal Krishna Mishra
Gopal Krishna Mishra - avatar
0
then what is tht iostream header file for ?? @chris
25th Feb 2017, 8:21 AM
Gopal Krishna Mishra
Gopal Krishna Mishra - avatar
0
thanku saqib.... thnx fr ur time.. all ur answers really cleared my doubts .. one last thing.. why do we use iostream ?😁😁 curious mind wat to do ??
25th Feb 2017, 8:25 AM
Gopal Krishna Mishra
Gopal Krishna Mishra - avatar