This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Resolution to PR 16715 causing linker errors?


Hi,

I am getting linker errors from basic_iostream, which seems to be caused
by the resolution to PR 16715. I'm seeing this on the 3.4 branch on
x86_64 FC1 Linux. I'm building from mainline for the first time in a
while, will report if that fails too.

2004-09-08  Benjamin Kosnik  <bkoz@redhat.com>
            Simon Richter  <Simon.Richter@hogyros.de>

        PR libstdc++/16715
        * include/bits/istream.tcc: Add extern template for iostream
        char and wchar_t instantiations.

Reverting that change makes the errors go away.

Reduced testcase:

    #include <istream>
    #include <ostream>

    template <typename C>
    class Test : public std::basic_iostream<C>
    {
    public:
        Test() : std::basic_iostream<C>(0) {}
    };

    #include <iostream>

    int main()
    {
        Test<char> t;
        std::cout << '\n';
    }

this gives:

[redi@morion tests]$ g++34 pr16715.cc
/tmp/ccHlzjH4.o(.gnu.linkonce.t._ZN4TestIcED1Ev+0x64): In function `Test<char>::~Test()':
: undefined reference to `std::basic_iostream<char, std::char_traits<char> >::~basic_iostream()'
/tmp/ccHlzjH4.o(.gnu.linkonce.t._ZN4TestIcEC1Ev+0x2d): In function `Test<char>::Test()':
: undefined reference to `std::basic_iostream<char, std::char_traits<char> >::basic_iostream(std::basic_streambuf<char, std::char_traits<char> >*)'
/tmp/ccHlzjH4.o(.gnu.linkonce.r._ZTC4TestIcE0_Sd+0x18): undefined reference to `std::basic_iostream<char, std::char_traits<char> >::~basic_iostream()'
/tmp/ccHlzjH4.o(.gnu.linkonce.r._ZTC4TestIcE0_Sd+0x20): undefined reference to `std::basic_iostream<char, std::char_traits<char> >::~basic_iostream()'
/tmp/ccHlzjH4.o(.gnu.linkonce.t._ZN4TestIcED0Ev+0x64): In function `Test<char>::~Test()':
: undefined reference to `std::basic_iostream<char, std::char_traits<char> >::~basic_iostream()'
collect2: ld returned 1 exit status

Am I doing something wrong?
(it's late, but this code has always compiled before)

jon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]