View Single Post
Old 19th May 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
Join Date: May 2008
Location: USofA
Posts: 1,547

Originally Posted by 18Googol2 View Post
".h" was missing. iostream ==> iostream.h
#include <iostream>
is correct and standard C++, the .h part is the old method and I believe is depreciated in modern C++.

Although you might find a compiler that barfs about missing .h's you probably will never find one that complains by default about them.

I believe one of the changes in the transition from Qt3 to Qt4 is #include <QWhatEver> is now the preferred norm as well over the old #include <QWhatEver.h> or die.

(Disclaimer: I have avoided using C++ for a long time now, I prefer ISO/IEC 9899:1999 aka C99 ).

If one doesn't need access to much of the (entire) std namespace it's probably best to do something else in a larger (more realistic) program, but I think everyone here knows that and I use helloworlds to test new compilers/IDE's as well

The name spaces related syntax and templates are one of the very few things that I like about C++.

Originally Posted by Johnny2Bad View Post
The thing wouldn't execute from the current directory so

failed, but when I typed...

it finally said "Hello World"!
This is because the shell uses a search path to locate programs. Everything on the command prompt is eventually tokenized and checked.

If $PATH is == /bin:/usr/bin typing 'hello' tells the shell to look for /bin/hello and then /usr/bin/hello.

If you don't like doing the ./hello thing you'll have to add the current working directory to your shells $PATH.
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote