Error building

Gianluca Sforna giallu at gmail.com
Mon Apr 27 13:46:06 UTC 2009


2009/4/25 Fabrício Godoy <skarllot at gmail.com>:
> I found the problem. But I don't know why.
>
> This compiles on Windows MinGW, but not in Fedora MinGW:
> Glib::ustring::format(std::setfill('0'), std::setw(2), 30);
>
> This compiles on Fedora MinGW, but not in Windows MinGW:
> Glib::ustring::format(std::setfill(L'0'), std::setw(2), 30);
>

I have a smaller test case showing the problem. If you compile:

#include <iomanip>
#include <sstream>

using namespace std;
int main ()
{
std::wostringstream stream;
//std::ostringstream stream;

  stream << setfill ( 'x' )  << setw (10);
  return 0;

}

you get the same error. the error goes away if you use an
ostringstream instead of a wostringstream (or if you use the 'L'
modifier).

Now guess what, glibmm has this in ustring.h:

class ustring::FormatStream
{
private:
#ifdef GLIBMM_HAVE_WIDE_STREAM
  typedef std::wostringstream StreamType;
#else
  typedef std::ostringstream StreamType;
#endif

So I assume we compile glibmm with GLIBMM_HAVE_WIDE_STREAM defined.
Still not sure what is the correct fix to the issue...

HTH

G.


-- 
Gianluca Sforna

http://morefedora.blogspot.com
http://www.linkedin.com/in/gianlucasforna



More information about the mingw mailing list