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
14 odpowiedzi
+ 9
Please post your entire code for inspection.
+ 3
type #include <iostream>
+ 3
add a line below #include <iostream>
using namespace std;
+ 2
dear try to save your file with extension .cpp instead of .c
it will help
+ 2
type using namespace std;
+ 2
every c++ program has using namespace std;
its so you can use the std library
+ 1
#include <iostream> if this gives error try #include <iostream.h>
+ 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;
+ 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::
0
tried iostream.h .. still showing errors.. thanku fr ur concern
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
0
oh yeah it worked @saqib.. but can u please xplain what is the significance of that line
0
then what is tht iostream header file for ?? @chris
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 ??