BUG: LNK2001 on Member Function When Use Nested Class TemplateLast reviewed: July 24, 1997Article ID: Q128789 |
The information in this article applies to:
SYMPTOMSWhen you build a program that uses nested class templates, the following link error is generated:
test.obj: error LNK2001: unresolved external symbol "?Funtion@BB@?$AA@HH@@QAEHXZ ( public: int __thiscall AA<int,int>::BB::Funtion(void) )" CAUSEThe compiler does not generate code for the member function in the nested class template.
RESOLUTIONTo work around the problem, use one of the following suggestions:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONThe following code can be used to reproduce or work around the problem.
Sample Code
/* Compile options needed: None. */ #include <stdio.h> template <class T1, class T2> class AA { public: class BB { public: int Function(); // Work around #1, replace the previous line with // int Function() { return 0; } }; }; // Work around #2, uncomment the following function // AA<int,int>::BB::Function() // { // return 0; // } template <class T1, class T2> int AA<T1,T2>::BB::Function() { return 0; } void main() { AA<int,int>::BB b; printf( "%d\n", b.Function() ); } |
Additional query words: 9.0 9.00 9.1 9.10 10.00 10.10 10.20
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |