problems with std::codecvt

Tim Brown compusr129@smail.info
Wed Aug 21 21:13:00 GMT 2002


I am using libstdc++ version 3.0.4. I'm having problems when I compile programs using the fstream class. This is the output of g++:
/tmp/ccunMOZK.o: In function `std::codecvt<char, char, __mbstate_t> const& std::use_facet<std::codecvt<char, char, __mbstate_t> >(std::locale const&)':
/tmp/ccunMOZK.o(.gnu.linkonce.t._ZSt9use_facetISt7codecvtIcc11__mbstate_tEERKT_RKSt6locale+0x7): 
undefined reference to `std::codecvt<char, char, __mbstate_t>::id'
collect2: ld returned 1 exit status

This is one of the source files I tried to compile:
//: C02:Scopy.cpp
// Copy one file to another, a line at a time
#include <string>
#include <fstream>
using namespace std;

int main() {
  ifstream in("Scopy.cpp"); // Open for reading
  ofstream out("Scopy2.cpp"); // Open for writing
  string s;
  while(getline(in, s)) // Discards newline char
    out << s << "\n"; // ... must add it back
} ///:~

I know it has to do with the fstream class because when I compiled
a program that just used strings, it compiled fine.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20020821/111ba409/attachment.htm>


More information about the Libstdc++ mailing list