static memeber initialization in constructor??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



g++ 3.2.2 under Linux Mandrake-9.1

I have a class A being derived from base class B

class A: public B
{
   public:

      A() : B("starter") { init_one(); }

   // other public methods..

   protected:
      const int MAX = 10;
      static long one[MAX];
      static void init_one()
      {
         for(int i = 0; i < MAX; i++)
	    one[i] = 9;
      }
};


Whem compiled the ld fails with message that there is undefined reference to
 A::one

So, can one initialize a static member in the above scenario?

-ishwar


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux