I get these error messages for all cout
and endl
:
main.cc:17:5: error: ‘cout’ was not declared in this scope
main.cc:17:5: note: suggested alternative:
/usr/include/c++/4.6/iostream:62:18: note: ‘std::cout’
After following the suggestion, everything is fine. Now I am curious, why I had to do that. We used C++ in classes before, but I never had to write a std::
before any of those commands. What might be different on this system?
std
namespace that every single introductory course to C++ I've ever seen seems to adopt... – Wileenstd
, on the contrary. It is bad to import all the names it contains (with ausing namespace std
directive) just to avoid typing thestd::
prefix, because this defeats the very purpose of a namespace. (see this faq). My 3 years old rant was aimed at C++ introductory courses and examples that systematically does that, thereby instiling bad habits in C++ learners. – Wileen