This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
"basic_filebuf" link errors with GCC 3.0
- To: libstdc++ at gcc dot gnu dot org
- Subject: "basic_filebuf" link errors with GCC 3.0
- From: Richard Atterer <aosife at atterer dot net>
- Date: Thu, 9 Aug 2001 00:49:26 +0200
[Please CC me, I'm not subscribed to this list.]
Hello,
I'm in the process of converting one of my programs to compile under
GCC 3.0, but I'm experiencing link problems. Somehow I have the
impression that I'm missing something simple and obvious, but just
/what/... This "gcc-3.0" I'm using is the g++-3.0 3.0-0pre010403
prerelease package in Debian testing.
A minimal example for my problem is:
#include <fstream>
typedef std::basic_ifstream<unsigned char> bifstream;
int main() { bifstream("/dev/zero"); }
When I try to compile this, I get:
> g++-3.0 -Wall x.cc -o x
g++-3.0 -Wall x.cc -o x
/tmp/ccFpFQwg.o: In function `std::basic_ifstream<unsigned char, std::char_traits<unsigned char> >::basic_ifstream(char const*, std::_Ios_Openmode)':
/tmp/ccFpFQwg.o(.gnu.linkonce.t._ZNSt14basic_ifstreamIhSt11char_traitsIhEEC1EPKcSt13_Ios_Openmode+0x39): undefined reference to `std::basic_filebuf<unsigned char, std::char_traits<unsigned char> >::basic_filebuf()'
/tmp/ccFpFQwg.o: In function `std::basic_ifstream<unsigned char, std::char_traits<unsigned char> >::open(char const*, std::_Ios_Openmode)':
/tmp/ccFpFQwg.o(.gnu.linkonce.t._ZNSt14basic_ifstreamIhSt11char_traitsIhEE4openEPKcSt13_Ios_Openmode+0x2a): undefined reference to `std::basic_filebuf<unsigned char, std::char_traits<unsigned char> >::open(char const*, std::_Ios_Openmode)'
collect2: ld returned 1 exit status
It looks a bit as if the template definitions aren't seen by the
compiler, but I've verified (using "g++-3.0 -Wall x.cc -E") that
bits/std_fstream.h is indeed included. So what's the problem?
Aside: The typedef above doesn't work with GCC 2.95, so currently my
setup is to do a "typedef ifstream bifstream;" for GCC 2.95, which
works.
Cheers,
Richard
--
__ _
|_) /| Richard Atterer
| \/¯| http://atterer.net
¯ ´` ¯