static problem in c++

Started by
14 comments, last by Trillobit 17 years, 6 months ago



_

[Edited by - Trillobit on October 9, 2006 5:20:29 PM]
Advertisement
Quote:Original post by Trillobit
Hmm.. About the includes, should I include vgc in both Entity.h and Entity.cpp?

I tried switching those includes, I get this now:

.\Entity.cpp(4) : error C2143: syntax error : missing ';' before 'Entity::collection'

vgc.h includes a lot of files, including the vgcvector.
vgc.h doesn't need to be included in both Entity.h and Entity.cpp (the latter include is redundant and can be removed).

Also, you might try making the following change to your code:
typedef typename Entity_Vector::iterator Entity_Iterator;
This will probably fix the missing ';' error you mentioned.
I added typename, like you said, and I get this error instead:
..\Entity.h(29) : error C2899: typename cannot be used outside a template declaration

Unfortunatly the other error seems to remain, second error is:
.\Entity.cpp(4) : error C2143: syntax error : missing ';' before 'Entity::collection'

And any comments on code style/design improvements is also very welcomed :)
Quote:Original post by Trillobit
I added typename, like you said, and I get this error instead:
..\Entity.h(29) : error C2899: typename cannot be used outside a template declaration

Unfortunatly the other error seems to remain, second error is:
.\Entity.cpp(4) : error C2143: syntax error : missing ';' before 'Entity::collection'

And any comments on code style/design improvements is also very welcomed :)
Sorry, that was my mistake - the typename keyword is not required in this case. As for the 'missing ;' error, it's not immediately clear to me where that's coming from...
Try this (in Entity.cpp):
Entity::Entity_Vector Entity::collection;
Yes!

So obvious when pointed out, many thanks!

I hope everything else works out now :)

cheers

This topic is closed to new replies.

Advertisement