Hello all,
I'm having a strange problem with G++...
In one source file 'fb3data.cc', I define arrays like this:
const float svcoeff44 [216] =
{
1.631996e-03, 6.335480e-02, ...
...
};
There are five of these. In 'fbdata3.h' I have
extern const float svcoeff44 [216];
extern const float svcoeff48 [216];
extern const float svcoeff88 [216];
...
Finally in 'filtbank3.cc' there is
const float *c;
switch (fsam)
{
case 44100:
c = cvcoeff44;
break;
case 48000:
c = cvcoeff48;
break;
...
}
Everything compiles without errors or warnings, but the linking
step fails:
/usr/bin/ld: filtbank3.o: warning: relocation against `svcoeff88' in read-only section
`.text'
/usr/bin/ld: filtbank3.o: in function `VocFiltbank::init(int)':
filtbank3.cc:(.text+0x159): undefined reference to `svcoeff192'
/usr/bin/ld: filtbank3.cc:(.text+0x1d3): undefined reference to `svcoeff48'
/usr/bin/ld: filtbank3.cc:(.text+0x1e3): undefined reference to `svcoeff96'
/usr/bin/ld: filtbank3.cc:(.text+0x1f3): undefined reference to `svcoeff44'
/usr/bin/ld: filtbank3.cc:(.text+0x1ff): undefined reference to `svcoeff88'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
When I put the arrays in 'filtbank3.cc' instead, everything works.
Any hints ??
Ciao,
--
FA