Flzw wrote:
I have a class declared in a header file that has a static vector
variable which I get unresolved external errors when I try to access it, I
understand static members should be declared in cpp but how is it done in this
case?
You *declared* the static member in your class. You have apparently
nowhere *defined* the member:
| // file: foo.hpp
| struct foo {
| static std::vector<int> bar; // declaration
| // ...
| };
| // file: foo.cpp
| #include "foo.hpp"
| std::vector<int> foo::bar; // definition
Of course, the header should be protected against mulitple inclusion
but this should highlight the needed definition.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting