Re: static members in c++ class

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

 



Hi ivar,

Do not define external linkage variables in header files.  Declaring them is
fine; defining them is not.  Keeping in mind that the terms "declare" means
it generates no bytes (more or less) of code or data, and "define" *does*
produce bytes.

Byte producing declarations (code or data) should be in .cpp files, not .h
files.

If you do put the variable's definition in the header file, that means you
cannot include that header file in any other translation unit that is linked
together.

If you tried, you'd get multiple definitions of the same variable.  Just as
you are seeing.

It appears you included (directly or indirectly) your header file in both
ibroker.o and imaker5.o.

HTH,
--Eljay



[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