Web lists-archives.com

Re: [Mingw-users] 'to_string' is not a member of 'std'




> From: Keith Marshall <keithmarshall@xxxxxxxxxxxxxxxxxxxxx>
> Date: Mon, 8 May 2017 23:12:59 +0100
> 
> >   cli/cli-script.c: In member function 'std::__cxx11::string user_args::insert_args(const char*) const':
> >   cli/cli-script.c:809:16: error: 'to_string' is not a member of 'std'
> > 	new_line += std::to_string (m_args.size ());
> > 		    ^
> > 
> > It turns out this is an old issue:
> > 
> >   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52015
> > 
> > Does anyone know whether the underlying issue with MinGW runtime is
> > resolved in the latest mingwrt?
> 
> What version of mingwrt are you using now?

3.22.2

> This WJFFM:
> 
>   $ cat foo.cpp
>   #include <string>
>   int main() { std::to_string(10); }
> 
>   $ mingw32-g++ --version
>   mingw32-g++ (GCC) 5.3.0
>   Copyright (C) 2015 Free Software Foundation, Inc.
>   This is free software; ...
> 
>   $ grep VERSION $(dirname $(which mingw32-g++))/../include/_mingw.h
>   ...
>   #define __MINGW32_VERSION           5000000L
> 
>   $ mingw32-g++ -c -std=c++11 -fsyntax-only foo.cpp
>   <no diagnostic output here>
> 
>   $ mingw32-g++ -c -std=gnu++11 -fsyntax-only foo.cpp
>   <no diagnostic output here>
> 
> but, if you neglect the C++11 requirement:
> 
>   $ mingw32-g++ -c -fsyntax-only foo.cpp
>   foo.cpp: In function 'int main()':
>   foo.cpp:2:14: error: 'to_string' is not a member of 'std'
>    int main() { std::to_string(10); }
>                 ^

The compilation command line did use -std=gnu++11, so that's not the
problem.

First, I owe an apology: I didn't look closely enough at
basic_string.h, so I've missed the fact that the problematic cpp macro
was _GLIBCXX_USE_C99, not _GLIBCXX_HAVE_BROKEN_VSWPRINTF (the latter
guards the to_w* methods, not to_string).  And mingwrt-5.0 indeed
defines _GLIBCXX_USE_C99 in _mingw.h.

So yes, using the latest mingwrt solves this particular problem.

However, it introduces another problem, which I will report in a
separate message.

Thanks.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe