Jump to content

Getting "error: `cout' undeclared" when compiling


Recommended Posts

Hi.

 

When I try compiling the following source using g++:

 

#include <iostream>
 int main()
   {
   cout << "Hello, World\n";
   return -1;
   }

I get:

 

hello.cc: In function `int main()':

hello.cc:4: error: `cout' undeclared (first use this function)

hello.cc:4: error: (Each undeclared identifier is reported only once for each function it appears in.)

 

Can anyone help me fix this?

Edited by scaryfast
Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...