Note: This began in the thread "[CentOS] 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 at dell2400 ~]$ ./a.out
Hello, World! I am 8 Today!
[devel at 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;
} ///:~