On 5/24/07, chipaug <[EMAIL PROTECTED]> wrote:
>
> I'm trying to learn C++. I've gotten a copy of "Accelerated C++" and
> have started to read. I got as far as the first paragraph in chapter
> 0 before getting stuck. The Hello World program in the book is as
> follows.
>
> // a small C++ program
>
> #include <iostream.h>
You need
#include <iostream>
instead. The .h versions of the headers are non-standard, and don't use
namespaces.
int main()
> {
> std::cout << "Hello, World!" << std::endl;
> return 0;
> }
>
> When I attempt to build this in Visual Studio 6, I get the following
> errors.
>
> C:\Documents and Settings\Kenneth\My Documents\cpp\1
> \HelloWorld\HelloWorld.cpp(7) : error C2653: 'std' : is not a class
> or namespace name
> C:\Documents and Settings\Kenneth\My Documents\cpp\1
> \HelloWorld\HelloWorld.cpp(7) : error C2653: 'std' : is not a class
> or namespace name
>
> If I remove the "std::" from the cout and endl, it appears to build
> without complaint and runs with the expected output.
>
--
PJH
"I contend that we are both atheists. I just believe in one fewer god than
you do. When you understand why you dismiss all the other possible gods, you
will understand why I dismiss yours."
-- Stephen Roberts
[Non-text portions of this message have been removed]