help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: #include <iostream> ERROR


From: Vipin Dravid
Subject: Re: #include <iostream> ERROR
Date: Sat, 17 Jun 2006 00:27:35 +0530

cout is declared in namespace std, so either bring it to global
namespace by "using" directive or use explicit qualification:

--snip--
#include <iostream>
using namespace std;

int
main()
{
         cout << "Test\n";
         return 0;
}

--snip--

Or

--snip--
#include <iostream>

int
main()
{
        std::cout << "Test\n";
        return 0;
}
--snip--

should compile fine

On 6/16/06, Steve Bby <steve_bby@yahoo.com> wrote:
I compile a small program below:
********************
#include <iostream>

main()
{
         cout << "Test\n";
}
********************

GOT ERROR:
=====================
$ g++ -o bmain bmain.c
bmain.c: In function `int main()':
bmain.c:5: error: `cout' undeclared (first use this function)
bmain.c:5: error: (Each undeclared identifier is reported only once for each 
function it appears in.)
$

What's wrong. Help please!

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus



--
Regards,
V i p i n

Life is what happens to you while you are busy making other plans.
- John Lenon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]