undefined reference to `__static_initialization_and_destruct

Forum thread started by hunnia on Wed, 2006-02-22 05:43

I built a new xform. (I hope it is allright)
The new Lyx is almost built.
When linking up all the objects to create lyx, I get 2 or 3 places this error message.

gcc is Ver. 2.9... (Used in BEOS)

What can be the problem, solution?

Example:
Bullet.o: In function `global constructors keyed to Bullet::Bullet(int, int, int)':
Bullet.o(.text+0xabe): undefined reference to `__static_initialization_and_destruction_0'
Bullet.o: In function `global destructors keyed to Bullet::Bullet(int, int, int)':
Bullet.o(.text+0xaea): undefined reference to `__static_initialization_and_destruction_0'

The code look like this:
Bullet const ITEMIZE_DEFAULTS[4] = { Bullet(0, 8),//"\\(\\bullet\\)"
Bullet(0, 0),//"\\normalfont\\bfseries{--}"
Bullet(0, 6),//"\\(\\ast\\)"
Bullet(0, 10) };//"\\(\\cdot\\)"

// will need these later if still using full text as below
// \usepackage{latexsym,pifont,amssymb}
// and wasysym when that panel is created

Bullet::Bullet(int f, int c, int s)
: font(f), character(c), size(s), user_text(0)
{
if (f < MIN || f >= FONTMAX) {
font = MIN;
}
if (c < MIN || c >= CHARMAX) {
character = MIN;
}
if (s < MIN || s >= SIZEMAX) {
size = MIN;
}
generateText();
#ifdef ENABLE_ASSERTIONS
testInvariant();
#endif
}

Bullet::Bullet(string const & t)
: font(MIN), character(MIN), size(MIN), user_text(1), text(t)
{
#ifdef ENABLE_ASSERTIONS
testInvariant();
#endif
}

etc ......

string const Bullet::bulletEntry(int f, int c)
{
// Despite how this may at first appear the static local variables
// are only initialized once..
// This is a work-around to avoid the "Static Initialization Problem"
// and should work for all compilers. See "C++ FAQs" by Cline and Lomow,
// Addison-Wesley, 1994, FAQ-180 pp169-171 for an explanation.
// Doing things this way also makes it possible to generate `text' at
// the time of construction. It also encapsulates the conversion
// of font, character and size entries to text.

// The single 2-dim array had to be changed to multiple 1-dim arrays
// to get around a compiler bug in an earler version of gcc (< 2.7.2.1)
// static string const BulletPanels[FONTMAX][CHARMAX] = {
static char const * BulletPanel0[CHARMAX] = {
/* standard */
"\\normalfont\\bfseries{--}", "\\(\\vdash\\)",
"\\(\\dashv\\)", "\\(\\flat\\)", "\\(\\natural\\)",
"\\(\\sharp\\)", "\\(\\ast\\)", "\\(\\star\\)",
"\\(\\bullet\\)", "\\(\\circ\\)", "\\(\\cdot\\)",
"\\(\\dagger\\)", "\\(\\bigtriangleup\\)",
"\\(\\bigtriangledown\\)", "\\(\\triangleleft\\)",
"\\(\\triangleright\\)", "\\(\\lhd\\)", "\\(\\rhd\\)",
"\\(\\oplus\\)", "\\(\\ominus\\)", "\\(\\otimes\\)",
"\\(\\oslash\\)", "\\(\\odot\\)", "\\(\\spadesuit\\)",
"\\(\\diamond\\)", "\\(\\Diamond\\)", "\\(\\Box\\)",
"\\(\\diamondsuit\\)", "\\(\\heartsuit\\)",
"\\(\\clubsuit\\)", "\\(\\rightarrow\\)", "\\(\\leadsto\\)",
"\\(\\rightharpoonup\\)", "\\(\\rightharpoondown\\)",
"\\(\\Rightarrow\\)", "\\(\\succ\\)"
};
static char const * BulletPanel1[CHARMAX] = {

etc....