Re: [SLUG] C++ newbie problems

From: Carson Wilcox (carsonwilcox@mail.arczip.com)
Date: Thu Jan 09 2003 - 06:28:24 EST


The problem is that generally cc refers to the c compiler, not the
C++ compiler and the c compiler doesn't know about cout.

I also have to add the the correct way to write the cout line is:

cout << "Welcome to C++!" << endl;

The you have it will work but is not the C++ way.

Carson

Carson R. Wilcox
Senior Systems Architect
Fujitsu Consulting
Tampa, FL
carsonw@users.sf.net

---------- Original Message ----------------------------------
From: Doug Koobs <dkoobs@dkoobs.com>
Reply-To: slug@nks.net
Date: 08 Jan 2003 23:26:14 -0500

>I'm trying to learn a bit about programming using C++... Here is
my
>first program:
>
>//First Program, welcome.C
>
>#include <iostream>
>
>int main()
>{
> cout << "Welcome to C++!\n";
> return 0;
>}
>
>When I type cc welcome.C at the shell, I get the following:
>
>welcome.C: In function `int main()':
>welcome.C:8: `cout' undeclared (first use this function)
>welcome.C:8: (Each undeclared identifier is reported only once
for each
> function it appears in.)
>
>After doing some searching on the Internet, it looks like it has
>something to do with namespace (whatever that is), and I need to
add a
>line something like:
>
>using namespace std;
>
>I added that, but got even more errors... I'm running gcc-3.2-7.
What am
>I doing wrong? Thanks!
>
>Doug
>
>
>
>
>



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 13:06:40 EDT