This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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]

Can't get wifstream to work.


Hi,

I'm trying to get a wide input file stream using the class wifstream.

I tried

	wifstream input ("filename");

but got a compiler error

	wifstream undeclared (first use this function)

So I tried to use the ifstream template with wchar_t.

	basic_ifstream <wchar_t> input("filename");

which gave me a linker error (see linker error at bottom of email)

I tried this with both the mingw and the cygwin compiler and got the same
result. After searching the web for a few hours I came up with a couple of
indications that GCC might not support wchar_t (but no solid evidence). Is
this true or is it something I'm doing wrong ?



fileReadTest.cpp: In function `int main(int, char**)':
fileReadTest.cpp:49: no matching function for call to `
   std::basic_ifstream<wchar_t, std::char_traits<wchar_t> >::get(char&)'
d:/mingw/include/c++/3.2.3/bits/istream.tcc:514: candidates are:
   _Traits::int_type std::basic_istream<_CharT, _Traits>::get() [with _CharT
=
   wchar_t, _Traits = std::char_traits<wchar_t>]
d:/mingw/include/c++/3.2.3/bits/istream.tcc:546:
   std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
   _Traits>::get(_CharT&) [with _CharT = wchar_t, _Traits =
   std::char_traits<wchar_t>]
d:/mingw/include/c++/3.2.3/bits/istream.tcc:580:
   std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
   _Traits>::get(_CharT*, int, _CharT) [with _CharT = wchar_t, _Traits =
   std::char_traits<wchar_t>]
d:/mingw/include/c++/3.2.3/istream:162:
   std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
   _Traits>::get(_CharT*, int) [with _CharT = wchar_t, _Traits =
   std::char_traits<wchar_t>]
d:/mingw/include/c++/3.2.3/bits/istream.tcc:622:
   std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
   _Traits>::get(std::basic_streambuf<_CharT, _Traits>&, _CharT) [with
_CharT =
   wchar_t, _Traits = std::char_traits<wchar_t>]
d:/mingw/include/c++/3.2.3/istream:169:
   std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
   _Traits>::get(std::basic_streambuf<_CharT, _Traits>&) [with _CharT =
   wchar_t, _Traits = std::char_traits<wchar_t>]
make: *** [test] Error 1



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