help-gplusplus
[Top][All Lists]
Advanced

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

Re: compile error


From: Robert Heller
Subject: Re: compile error
Date: Tue, 07 Oct 2008 14:17:16 -0500

At Tue, 7 Oct 2008 08:50:41 -0700 (PDT) Randy AC7NJ <ac7nj@arrl.net> wrote:

> 
> the error I get is
> myfirst.c:5: error: 'cout' was not declared in this scope
> 
> / / myfirst.c --displays a  message
> #include <iostream>
> int main(void)
> {
>       cout << "come up and C++ me sometime.";
>       cout << "\n";
>       return 0;
> }
>                                                                               
>                                                   

You need to 'use' the std namespace, either with a 'using' statement:\

using namespace std;

Or else you need to qualify the cout references:

        std::cout

Eg:

// myfirst.c --displays a  message
#include <iostream>   
int main(void)
{
      std::cout << "come up and C++ me sometime.";
      std::cout << "\n";
      return 0;
}


-- 
Robert Heller             -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software        -- Linux Installation and Administration
http://www.deepsoft.com/  -- Web Hosting, with CGI and Database
heller@deepsoft.com       -- Contract Programming: C/C++, Tcl/Tk
                                


reply via email to

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