public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Greg Wimpey <greg.wimpey@waii*removetomail*.com.invalid>
To: help-gcc@gnu.org
Subject: Re: help, gcc, ?cout error?
Date: Fri, 31 Dec 1999 22:24:00 -0000	[thread overview]
Message-ID: <sn1z8qvia7.fsf@ddcspn37.denver.waii.com> (raw)
Message-ID: <19991231222400.wnDum7am3Yx3vRmWIUaDMKHblO2SnvUD9B2yb0r3qNY@z> (raw)
In-Reply-To: <3853e4af.91799515@usenet.nau.edu>

aka007@mail.com writes:

> thanks for letting me know what the diff was with gcc vs g++...
> 
> hope this is still valid here?  anyhow, here is current version of my
> "hello" program:
> 
> UW PICO(tm) 2.9                  File: a.cpp
> 
> #include <iostream>
> using namespace std;
> 
> int main() {
>   cout << "hello";
>   return 0;
> }
> 
> using command g++ -o a a.cpp , then it "thinks" for a moment, but
> creates no output on the telnet session screen.  pico a.out reveals an
> empty file, no "hello" in there at all...    at least no error
> messages.
> 

Does your code really say "#include <iostream>"?  That should be
"#include <iostream.h>", unless GCC has some facility for automagically
tacking the ".h" onto the end of the file name.

Second, the command line "g++ -o a a.cpp" will put the compiled code
in a file called "a", not "a.out".  You'll only see output in "a.out" if
you don't give it an output file name with the "-o" flag.

Finally, you shouldn't expect to see "hello" in your compiler output.
Your compiler output will be the executable, not the output of the program.
You need to execute the code; then you'll see the output.  It should go
something like this:

% g++ -o a a.cpp
% ./a
hello %

(Note that the lack of a newline ("\n") in your string means that the 
prompt will appear on the same line as your output.)

-- 
Greg Wimpey
greg.wimpey@waii*removetomail*.com.invalid

  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-31 22:24   ` Dave Topham
1999-12-11 17:49 ` Dave Topham
1999-12-11 20:34   ` aka007
1999-12-12  9:09     ` Tom Barron
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 [this message]
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-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=sn1z8qvia7.fsf@ddcspn37.denver.waii.com \
    --to=greg.wimpey@waii*removetomail*.com.invalid \
    --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).