Need help to compile the file in C++ in linux

Status
Not open for further replies.

H_D_R

Full Member level 6
Joined
Jan 31, 2008
Messages
329
Helped
26
Reputation
52
Reaction score
9
Trophy points
18
Location
India
Activity points
0
Hello all,

i am learning C++ on linux.
i have tried to compile very simple code "Fiert.cc"

Code:
1: #include <iostream.h>
2:
3: main()
4: {
5:     float pi = 3.14;
6:     cout << "The value of pi is " << pi << "\n";
7:     return 0;

8: }
when i compiled this code i am getting such warning msg.


can any one please help me to solve this problem..??
 

Hi

Everything in standard headers like <iostream> is inside std namespace, hence
it's std::cin and std::cout .
btw, cin and cout are not functions.

change iostream.h by.. iostream

Code:
#include <iostream>
main()
{
float pi = 3.14;
std::cout << "The value of pi is " << pi << "\n";
return 0;
}

compile:
$ g++ Fiert.cc -o Fiert.out


g++ compile c++
gcc compile c

enjoy
 

    H_D_R

    Points: 2
    Helpful Answer Positive Rating
Thank you so much aospinas,

i have got the solution.
BTW, i was able to see output from my code also but the problem was warning. it was appearing on every compilation.

anyway thanks a lot again...!!!

God bless you..
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…