Template linking problem

Harvey Chapman hchapman@3gfp.com
Wed Nov 7 15:36:00 GMT 2007


On Nov 7, 2007, at 10:26 AM, Harvey Chapman wrote:

> class A
> {
> public:
>  static int number;
> };
>
> int A::number;

The line above is required.

That'll teach me to compile and test before e-mailing. I guess I've  
just never used a static data member in a class before, I usually only  
use static variables inside functions, if ever.

So, back to the original question, why do I have to specfically re- 
declare the static data member outside of the class header?

Thanks,

R.



More information about the Gcc-help mailing list