Wpis z mikrobloga

#cplusplus #naukacplusplus #informatykamator
Mam mały problem z użyciem standardu C++11 w kompilatorze MinGW.
Znalazłęm jego rozwiązanie tutaj:
http://stackoverflow.com/questions/8542221/stdstoi-doesnt-exist-in-g-4-6-1-on-mingw

,,This is a result of a non-standard declaration of vswprintf on Windows. The GNU Standard Library defines GLIBCXXHAVEBROKENVSWPRINTF on this platform, which in turn disables the conversion functions you're attempting to use. You can read more about this issue and macro here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37522.

If you're willing to modify the header files distributed with MinGW, you may be able to work around this by removing the !defined(GLIBCXXHAVEBROKENVSWPRINTF) macro on line 2754 of .../lib/gcc/mingw32/4.6.1/include/c++/bits/basicstring.h, and adding it back around lines 2905 to 2965 (the lines that reference std::vswprintf). You won't be able to use the std::towstring functions, but many of the other conversion functions should be available."

Usunąłem już
,,!defined(GLIBCXXHAVEBROKENVSWPRINTF)"
i teraz nie mam pojęcia gdzie mam wstawić ten fragment
Prawdopobnie gdzieś tutaj: (Tylko gdzie?)

// DR 1261.
inline wstring
towstring(int val)
{ return
gnucxx::_toxstring(&!defined(GLIBCXXHAVEBROKENVSWPRINTF), 4 * sizeof(int),
L"%d", _val); }

inline wstring
to
wstring(unsigned _val)
{ return
gnucxx::_toxstring(&std::vswprintf,
4 * sizeof(unsigned),
L"%u", _val); }

inline wstring
to
wstring(long _val)
{ return
gnucxx::_toxstring(&std::vswprintf, 4 * sizeof(long),
L"%ld", _val); }

inline wstring
to
wstring(unsigned long _val)
{ return
gnucxx::_toxstring(&std::vswprintf,
4 * sizeof(unsigned long),
L"%lu", _val); }

inline wstring
to
wstring(long long _val)
{ return
gnucxx::_toxstring(&std::vswprintf,
4 * sizeof(long long),
L"%lld", _val); }

inline wstring
to
wstring(unsigned long long _val)
{ return
gnucxx::_toxstring(&std::vswprintf,
4 * sizeof(unsigned long long),
L"%llu", _val); }

inline wstring
to
wstring(float _val)
{
const int
n =
gnucxx::_numerictraits::_maxexponent10 + 20;
return _gnucxx::_toxstring(&std::vswprintf, _n,
L"%f",
val);
}

inline wstring
to
wstring(double _val)
{
const int
n =
gnucxx::_numerictraits::_maxexponent10 + 20;
return _gnucxx::_toxstring(&std::vswprintf, _n,
L"%f",
val);
}

inline wstring
to
wstring(long double _val)
{
const int
n =
gnucxx::_numerictraits::_maxexponent10 + 20;
return _gnucxx::_toxstring(&std::vswprintf, _n,
L"%Lf",
_val);
}
#endif
  • 5
@Erk700: zostaniesz #!$%@? za nieuzywanie pastebin etc. Gdyby nie godzina to przeczytalbym polac kodu, ale zla forma (wpisu, moja zla tez dobrze nie rzutuje), dzien bo ej swienta motzno i forma ogolna. Jak cos ma 10+ linijek #!$%@? to na pastebina, czytelnosc +200
@Erk700: dzisiaj nie pomogę bo zbyt dużo we krwi krązy, ale może jutro okiem rzuce. ekspert cpp ze mnie żaden, ale cpp zawsze sostaje w mózgu
(plusik za wrzutke na to co formatuje i koloruje składnie, niby nic ale czytelność wzrasta)