Search code examples
c++classvariablesnamespaces

when declaring an object how do you specify the no name if it's ambiguous


I have an ambiguous variable declaration, e.g.:

Class myClass;


blah.h : error C2872: 'Class ' : ambiguous symbol
    could be 'foo.h(30) : Class '
    or 'foo2.h(106) : MyNamespace::Class '

How do I specifically declare the variable myClass to be of the former class declared in foo.h with no namespace?

Thanks in advance!


Solution

  • You can use the fully qualified class name which always starts with ::

    ::Class myClass;