From: Tom Barron <tbarron@mindspring.com>
To: help-gcc@gnu.org
Subject: Re: help, gcc, ?cout error?
Date: Fri, 31 Dec 1999 22:24:00 -0000 [thread overview]
Message-ID: <3853CDE3.331411D4@mindspring.com> (raw)
Message-ID: <19991231222400.RRp0UuHdqgyS29ihEK6tMR5Xd9m1DoEPfP_od1eGReg@z> (raw)
In-Reply-To: <3853018b.33642768@usenet.nau.edu>
Hi, Jesse. I pasted your code into a file called jesse.cpp on my
system. Watch this:
$ gcc jesse.cpp
/tmp/ccyMXXQa.o: In function `main':
/tmp/ccyMXXQa.o(.text+0x25): undefined reference to `cout'
/tmp/ccyMXXQa.o(.text+0x2a): undefined reference to
`ostream::operator<<(int)'
collect2: ld returned 1 exit status
$ g++ jesse.cpp
$ a.out
5$
The problem is that cout and iostream.h are part of C++, but gcc only
handles C. To compile C++ code, you need to invoke the compiler as g++.
To get a newline on the end of your output, you might want to do
cout << a << endl;
hth...
Tom
aka007@mail.com wrote:
>
> i modified it a bit, here is the current version:
>
> UW PICO(tm) 2.9 File: a.cpp
> ...
next prev parent reply other threads:[~1999-12-31 22:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-12-11 17:34 aka007
1999-12-11 17:49 ` Dave Topham
1999-12-11 20:34 ` aka007
1999-12-12 9:09 ` Tom Barron [this message]
1999-12-12 12:35 ` aka007
1999-12-12 15:35 ` Rick Dearman
1999-12-31 22:24 ` Rick Dearman
1999-12-12 19:56 ` Arthur Gold
1999-12-31 22:24 ` Arthur Gold
1999-12-13 10:01 ` Greg Wimpey
1999-12-31 22:24 ` Greg Wimpey
1999-12-31 22:24 ` aka007
1999-12-31 22:24 ` Tom Barron
1999-12-31 22:24 ` aka007
1999-12-31 22:24 ` Dave Topham
1999-12-11 17:49 ` Dave Topham
1999-12-31 22:24 ` Dave Topham
1999-12-12 21:35 ` aka007
1999-12-31 22:24 ` aka007
1999-12-31 22:24 ` aka007
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3853CDE3.331411D4@mindspring.com \
--to=tbarron@mindspring.com \
--cc=help-gcc@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).