I am trying to port my own lib from Visual Studio to g ++ on GNU / Linux, and I am having some problems compiling templates. Indeed, in Visual C ++, templates are only generated when they are explicitly used in the code, although it seems (from my mistakes) that g ++ evaluates the contents of the templates before they are first used. This results in the following error:
error: incomplete type ‘X’ used in nested name specifier
... because I am including some classes after the template code, not before. I do this because of conflict between conflicts.
So, Visual C ++ does not try to resolve the template content when used, and g ++ does the resolution as soon as possible.
class MyClass;
template<class _Ty>
void func(MyClass* a_pArg)
{
a_pArg->foo();
};
(_ Ty is not used, but it does not matter, just explain the problem)
Visual ++ ( MyClass ), g++ - , MyClass .
g++ ?