i have a
ifstream m_ifsInput
variable and I try to open a file like this:
m_ifsInput.open( sFileName.c_str() );
where sFileName is a std::wstring variable
the error i get when compiling with g++

no matching function for call to ‘std::basic_ifstream<char, std::char_traits<char> >::open(const wchar_t*)’

the thing is the same thing compiles well uner windows. Looking at the error i get with g++ would mean that there is no open method that takes a wchar_t* as parameter, but then, why the heck does it compile with visual studio ??? I mean it's a standard library function.. these should port ...

>Looking at the error i get with g++ would mean that there
>is no open method that takes a wchar_t* as parameter
g++ is correct. The C++ standard doesn't define an open member function that takes const wchar_t* as a filename type.

>but then, why the heck does it compile with visual studio ???
Visual Studio is correct. Nothing stops an implementation from supporting extensions to the standard classes as long as the standard stuff is conformant.

>I mean it's a standard library function.. these should port ...
If you rely on extensions, you can't expect your code to be portable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.