Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
"identifier" : friend declaration cannot be found in the nearest namespace scope
Remarks
The class template declaration for the specified template identifier cannot be found within the current namespace.
To correct this error
- Ensure that the class template declaration for the template identifier is defined in the current namespace or that the template identifier is a fully-qualified name.
Example
The following code example declares a class template and function in namespace NA, but attempts to declare a friend function template in namespace NB.
// C3771.cpp
// compile with: /c
namespace NA {
template<class T> class A {
void aFunction(T t) {}
};
}
// using namespace NA;
namespace NB {
class X {
template<class T> friend void A<T>::aFunction(T); // C3771
// try the following line instead
// template<class T> friend void NA::A<T>::aFunction(T);
// or try "using namespace NA;" instead.
};
}