my_test.h
#ifndef MY_TEST
#define MY_TEST
struct obj {
int x;
int y;
};
class A {
private:
const static int a=100;
const static obj b;
};
const obj A::b={1,2};
#endif
When compiling cpp using this header file, an error 'multiple definition of 'A::b'
occurs.
- why is this when I have been using guard macro already?
- why does
A::a
not produce the erro? (I can't write codeconst static obj b={1,2}
inclass A
)