Quantcast

'to_string' is not a member of 'std'

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

'to_string' is not a member of 'std'

Eli Zaretskii
I hit this problem today while building a pretest of GDB 8.0 with
MinGW.  The compilation errors out like this:

  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?  If so, would it be possible to have
an updated distribution of gcc-g++-5.3.0-2-mingw32-bin to go with that
mingwrt fix, such that to_string will now be usable in MinGW builds?

If the runtime issue is not yet fixed, what would it take to fix it?

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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 'to_string' is not a member of 'std'

Earnie Boyd
On 5/8/2017 1:23 PM, Eli Zaretskii wrote:

> I hit this problem today while building a pretest of GDB 8.0 with
> MinGW.  The compilation errors out like this:
>
>   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?  If so, would it be possible to have
> an updated distribution of gcc-g++-5.3.0-2-mingw32-bin to go with that
> mingwrt fix, such that to_string will now be usable in MinGW builds?
>
> If the runtime issue is not yet fixed, what would it take to fix it?
>

Does removing the _GLIBCXX_HAVE_BROKEN_VSWPRINTF guard make it work?

--
Earnie

------------------------------------------------------------------------------
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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 'to_string' is not a member of 'std'

Eli Zaretskii
> From: Earnie <[hidden email]>
> Date: Mon, 8 May 2017 14:19:50 -0400
>
> >   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?  If so, would it be possible to have
> > an updated distribution of gcc-g++-5.3.0-2-mingw32-bin to go with that
> > mingwrt fix, such that to_string will now be usable in MinGW builds?
> >
> > If the runtime issue is not yet fixed, what would it take to fix it?
> >
>
> Does removing the _GLIBCXX_HAVE_BROKEN_VSWPRINTF guard make it work?

It will most probably compile, but it isn't practical for me to try to
find out whether the result will work reliably, since I don't know
enough about the use cases in which the problem expressed itself.

In any case, if I remove the guard, it will only solve my personal
problem; others will still be unable to go in my footsteps and build
their own GDB.

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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 'to_string' is not a member of 'std'

Keith Marshall
In reply to this post by Eli Zaretskii
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/05/17 18:23, Eli Zaretskii wrote:

> I hit this problem today while building a pretest of GDB 8.0 with
> MinGW.  The compilation errors out like this:
>
>   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?  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); }
                ^

> If so, would it be possible to have an updated distribution of
> gcc-g++-5.3.0-2-mingw32-bin to go with that mingwrt fix, such that
> to_string will now be usable in MinGW builds?

The example above is run with my Linux hosted cross-compiler, which is,
AFAIK, completely consistent with the current MinGW.org GCC build, and
the most recent mingwrt-5.0 distribution.

> If the runtime issue is not yet fixed, what would it take to fix it?

Looks to me as if it should work just fine already.

- --
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iQIcBAEBAgAGBQJZEO1rAAoJEMCtNsY0flo/hNoP/RFRgCi8qT3fGuqtpoRF2+Nd
4UC7gWYcO2yT4btYRgY40P73pUVEhux166+GNKkmvIg4jbNtWJeEmpvYwDmalZfm
jPwsr4ROy4akROaCdgY5B1FLqpwJa8LS3yCP3atAORKYiUgb0BWZkbSy7KsItzEH
uWcCXjvrXOKpn+t9+hHhPV9H/3z8Jh+der7JKKuwfotjkOCpBN0duKn+w51aH7NS
rj6Uc96fpWiOCMF3Bs/KGW+2H0Ol219JTzk4AUBve9TDyZwGobG0BHKk4PdWHrMn
JmlTdC4hn0mFIkzuojWnrXHNCr9YNOqeH0OwysZtdu7Hcnyp41axdx3thrVI+LnW
D3FQOLSOzXgSa6yxQYVQxHzwFgRzoowq7F4xRS7gN6po4v1clbkdRMvO2mWBqsvT
5KRRC8lohxFrpwX0NAifjEE6SebE9h/ACFsIhT7Ka05foNsW/fRp5c+NbXnBPGb2
ww7VyBZ8cPhMFZ0i3pewb4EdoggeZC/wULS2mGrsD0fXmypnoGcgmXo+y4NPBnN2
i+odL3EDTWbsxjoM2Fcp0vSK97VWf9z7/nWVRLbPvIVWvXgIEbfR0HQbeofJmqmc
cY2K8HooeNUA1PaS4Qfs+My1IyHSKtgDow3i/+y5jD6nEFcujhaHYDTWmDb68U0W
BDVpI95ENPwBERbzIuxE
=zGZX
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 'to_string' is not a member of 'std'

David Gressett


-----Original Message-----
From: Keith Marshall [mailto:[hidden email]]
Sent: Monday, May 08, 2017 5:13 PM
To: [hidden email]
Subject: Re: [Mingw-users] 'to_string' is not a member of 'std'

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On May 5, 2017, Keith Marshall wrote:

>On 08/05/17 18:23, Eli Zaretskii wrote:
>> I hit this problem today while building a pretest of GDB 8.0 with
>> MinGW.  The compilation errors out like this:
>>
>>   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 ());
>>

                    ^
... snip ...

>What version of mingwrt are you using now?  This WJFFM:

 > $ cat foo.cpp
>#include <string>
> int main() { std::to_string(10); }

 ... snip ...
  $ mingw32-g++ -c -std=c++11 -fsyntax-only foo.cpp
  <no diagnostic output here>

...snip ...

>> If the runtime issue is not yet fixed, what would it take to fix it?

>Looks to me as if it should work just fine already.

I see much the same thing with my native build of gcc 6.3.0.

I must use -std=gnu++98 to see the error message.

(gcc 6 defaults to gnu++14)

------------------------------------------------------------------------------
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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 'to_string' is not a member of 'std'

Eli Zaretskii
In reply to this post by Keith Marshall
> From: Keith Marshall <[hidden email]>
> 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
[hidden email]

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:[hidden email]?subject=unsubscribe
Loading...