16411 – undefined reference to `__gnu_cxx::stdio_sync_filebuf<char, std::char_traits >::file()' (original) (raw)
Description Richard B. Kreckel 2004-07-07 16:45:56 UTC
The patch introduced to fix PR#14600 does not work on a Linux system when compiling with -O0:
$ cat link.cc
#include
#include <ext/stdio_sync_filebuf.h>
int main()
{
int fd = -1;
__gnu_cxx::stdio_sync_filebuf* buf;
if ( buf = dynamic_cast<__gnu_cxx::stdio_sync_filebuf*>(
std::cin.rdbuf() ) ) {
buf->file();
}
}
$ /net/gcc/3.4.1/bin/g++ -O0 link.cc
/tmp/ccVJfRKL.o(.text+0x178): In function main': : undefined reference to __gnu_cxx::stdio_sync_filebuf<char,
std::char_traits >::file()'
collect2: ld returned 1 exit status
The original patch to PR#14600 at <http://gcc.gnu.org/ml/libstdc++/2004-02/msg00379.html> had suggested two differnet ways to deal with this kind of problem. Unfortunately, they don't seem to have been considered.
Indeed, adding the mangled names _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE4fileEv; to ibstdc++-v3/config/linker-map.gnu solves this problem again.
This is also related to PR#14097 and PR#14098.