libstdc++/14: Cannot link if std::stringstream is used

michaelv@edifecs.com michaelv@edifecs.com
Tue Nov 16 22:07:00 GMT 1999


>Number:         14
>Category:       libstdc++
>Synopsis:       Cannot link if std::stringstream is used
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 16 22:07:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     michaelv@edifecs.com
>Release:        CVS souce from 11/15/99
>Organization:
>Environment:
Solaris 2.6, gcc 2.95.2
>Description:
If I use std::stringstream in a program, I get multiple undefind symbols.  The errors are:

Undefined			first referenced
 symbol  			    in file
collate<wchar_t> type_info function /var/tmp/ccfEVnBc.o
collate<char> type_info function    /var/tmp/ccfEVnBc.o
locale::classic(void)               /var/tmp/ccfEVnBc.o
locale::_S_global                   /var/tmp/ccfEVnBc.o
locale::operator==(locale const &) const/var/tmp/ccfEVnBc.o
ios_base::ios_base(void)            /var/tmp/ccfEVnBc.o
ctype<wchar_t> type_info node       /var/tmp/ccfEVnBc.o
ctype<char> type_info node          /var/tmp/ccfEVnBc.o
locale::_Impl::~_Impl(void)         /var/tmp/ccfEVnBc.o
collate<char> type_info node        /var/tmp/ccfEVnBc.o
collate<wchar_t> type_info node     /var/tmp/ccfEVnBc.o
basic_ios<char, char_traits<char> >::init(basic_streambuf<char, char_traits<char> > *)/var/tmp/ccfEVnBc.o
ctype<char> const & use_facet<ctype<char> >(locale const &)/var/tmp/ccfEVnBc.o
ctype<wchar_t> type_info function   /var/tmp/ccfEVnBc.o
ctype<char> type_info function      /var/tmp/ccfEVnBc.o
locale::_S_classic                  /var/tmp/ccfEVnBc.o
ios_base::failure::failure(basic_string<char, char_traits<char>, allocator<char> > const &)/var/tmp/ccfEVnBc.o
locale::operator=(locale const &)   /var/tmp/ccfEVnBc.o
ios_base::~ios_base(void)           /var/tmp/ccfEVnBc.o
ld: fatal: Symbol referencing errors. No output written to sst
collect2: ld returned 1 exit status

>How-To-Repeat:
Try to compile/link this program, setting the #defines as appropriate:

#include <cstdlib>
#include <cstdio>

#include <string>

#ifdef DO_SSTREAM
#include <sstream>
#endif


int main()
{
    std::string str;
    str = "abc";
    str += "123";
    printf("str: %s\n", str.c_str());

#ifdef DO_WIDE
    std::wstring wstr;
    wstr = L"xyz";
    wstr += L"890";
    printf("wstr: %S\n", wstr.c_str());
#endif

#ifdef DO_SSTREAM
    std::stringstream ss;
    ss.str() = "abc";
    ss << 123;
    printf("ss: %s\n", ss.str().c_str());

#ifdef DO_WIDE
    std::wstringstream wss;
    wss.str() = L"xyz";
    wss << 890;
    printf("wss: %S\n", wss.str().c_str());
#endif
#endif

    return 0;
}

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Libstdc++-prs mailing list