OT: C++ Newbie "Hello World" problem SOLVED

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



Note: This began in the thread " Probably a bad setup but
which one?" but I don't want to hijack that thread.  "tech" began with
a similar problem, with the Perl "Hello World" script.

fred smith wrote:
 	
> I can't get the "Hello World" program in the C++ book I began reading  to work. Seems to compile without errors, but nothing on my CRT.  Will  try it again and start a thread >here...   :-)

>Let me guess...

>you named it "test", right? Then when you run "test" "nothing" happens?

No. It is named Hello

>two things:
>1. there's already a program named test, which displays no output,
>it merely has an exit status.
>2. for a program in your current directory, run it with a preceding "./",
>e.g., "./test"--because "." is not in the path (and shouldn't be).

Fred: Thank you!   #2 was dead on.    :-)

[devel@dell2400 ~]$ ./a.out
Hello, World! I am 8 Today!
[devel@dell2400 ~]$

What I was lacking was the "./" in front of a.out    the file produced
when I compiled Hello.cpp   :-)

I will continue reading the book now!     :-)      Lanny


//: C02:Hello.cpp

// From Thinking in C++, 2nd Edition

// Available at http://www.BruceEckel.com

// (c) Bruce Eckel 2000

// Copyright notice in Copyright.txt

// Saying Hello with C++

#include <iostream> // Stream declarations

using namespace std;



int main() {

  cout << "Hello, World! I am "

       << 8 << " Today!" << endl;

} ///:~
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux