Sign in to follow this  
Marty666

static variables: UNRESOLVED EXTERNAL

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this