Quote:
Originally Posted by map250r
changed some data member declarations to be static. I also added definitions outside the class. Now gcc barfs with 'multiple definition of ...'
|
You can't have those definitions in multiple compilation units.
You put those definitions outside the class and inside a header, then included that header in multiple .cpp files and that is not permitted.
The usual correct approach is to put the definitions in a .cpp file rather than in a header file.
An alternative (that might be considered more maintainable code) is to wrap the definitions within the header file in some #ifdef and then define that symbol (before including that header) in exactly one compilation unit.