First off, I would say that this is different enough that you would have been better off creating a new thread, rather than posting in one several months old. Just for future reference.
While I cannot say for certain without seeing the code, from the error message given it sounds like the issue is namespace scoping. You see, the majority of objects and classes in the standard library are in the std
namespace, and have to be scoped for it in order for them to be visible, even if you have the headers which hold them #include
d already . To do this, you have three options:
- You can explicitly scope each reference to the object by prepending them with the
std::
scope marker; e.g.,std::cout
,std::endl
,std::string
, etc. This gives you the best control over the namespace scope, and is the preferred approach, but can be tedious to use. - You can add the entire
std
namespace to the local scope, by using the directiveusing namespace std;
at the top of the source file, right below the#include
directives. This is the easiest solution, and the most common, but it loses most of the advantages of having separate namespaces. Most professional programmers avoid this for all but the most trivial programs. - You can add the individual clases or objects to the local scope, by using the
using X::Y
form of the directive, e.g.,using std::cout;
. This lets you use that specific objects without explicit scoping, without polluting your local namespace …