static members in c++ class
ivar@imaker.no
ivar@imaker.no
Wed Sep 7 11:16:00 GMT 2005
Hello, I want to make a static members in a C++ class
and declare it as a private member:
static iKernel * inst;
,
after the class definition in the header file I define the variable:
iKernel * iKernel::inst=0;
When I compile the program I get the error:
ibroker.o(.bss+0x18):/usr/lib/gcc/i386-redhat-linux/4.0.0/../../../../include/c++/4.0.0/ext/mt_allocator.h:450:
multiple definition of `imaker::iBroker::inst'
imaker5.o(.bss+0x0):/usr/lib/gcc/i386-redhat-linux/4.0.0/../../../../include/c++/4.0.0/ext/mt_allocator.h:448:
first defined here
When I look at mt_allocator.h line 448 it shows:
static pool_type&
_S_get_pool()
{
static pool_type _S_pool;
return _S_pool;
}
Can anybody explain this ?
IB
More information about the Gcc-help
mailing list