Jump to content
  • Advertisement
Sign in to follow this  
Marty666

static variables: UNRESOLVED EXTERNAL

This topic is 5403 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
Advertisement
In your cpp file instead of the extern stuff...


vector<tVec3> cFace::Vertices;
int cFace::numverts;




Make sure you include the header too.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!