Article ID: 151167 - Last Review: December 2, 2003 - Revision: 2.0 BUG: LNK2001 Error for Static Member in Class Template
This article was previously published under Q151167 On This PageSYMPTOMS
Linker error LNK2001 is generated for static member variables of nested
classes in class templates. The message states:
error LNK2001: unresolved external symbol "public: static int
Outer<int>::Inner::sobj"(?sobj@Inner@?$Outer@H@@2HA)
RESOLUTION
Do not use static member variables in nested classes of class templates.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
MORE INFORMATION
The sample code below gives the error message LNK2001.
Sample CodeAPPLIES TO
| Other Resources Other Support Sites
CommunityArticle Translations |






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email

Back to the top