For future people struggling with a similar problem, the situation is that the compiler simply cannot find the type you are using (even if your Intelisense can find it).
This can be caused in many ways:
- You forgot to
#include
the header that defines it. - Your inclusion guards (
#ifndef BLAH_H
) are defective (your#ifndef BLAH_H
doesn’t match your#define BALH_H
due to a typo or copy+paste mistake). - Your inclusion guards are accidentally used twice (two separate files both using
#define MYHEADER_H
, even if they are in separate directories) - You forgot that you are using a template (eg.
new Vector()
should benew Vector<int>()
) - The compiler is thinking you meant one scope when really you meant another (For example, if you have
NamespaceA::NamespaceB
, AND a<global scope>::NamespaceB
, if you are already withinNamespaceA
, it’ll look inNamespaceA::NamespaceB
and not bother checking<global scope>::NamespaceB
) unless you explicitly access it. - You have a name clash (two entities with the same name, such as a class and an enum member).
To explicitly access something in the global namespace, prefix it with ::
, as if the global namespace is a namespace with no name (e.g. ::MyType
or ::MyNamespace::MyType
).