Sign in to follow this  

static variables: UNRESOLVED EXTERNAL

This topic is 4855 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I have a class defined in my header with:
	static vector<tVec3> Vertices;
	static numverts;

I use them in the .cpp file of this class and get these errors: cFace2.obj : error LNK2001: unresolved external symbol "private: static int cFace::numverts" (?numverts@cFace@@0HA) cFace2.obj : error LNK2001: unresolved external symbol "private: static class std::vector<struct tVec3,class std::allocator<struct tVec3> > cFace::Vertices" (?Vertices@cFace@@0V?$vector@UtVec3@@V?$allocator@UtVec3@@@std@@@std@@A) What am i doing wrong? I tried to make it public, private and protected (since my class is a friend class of itself)... It doesn't work anyways. Thanx, Marty PS: - I'm using MSVC6. - static variables only work in the file they're declared in, but I get loads of errors when I put this at the beginning of the cpp file.
extern static cFace::vector<tVec3> Vertices;
extern static cFace::int numverts;

[Edited by - Marty666 on October 3, 2004 8:12:38 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this