2013/2/15 Jim Michaels <jmichae3@yahoo.com>
#include <string>
#include <iostream>
#include <stdint.h>
int main(void) {
    int64_t n=5;
    std::string s=std::to_string(n); //http://www.cplusplus.com/reference/string/to_string/
    std::cout<<s;
    return 0;
}
Thu 02/14/2013 23:16:40.04||E:\prj\createfile\createfile-3.28\tests|>type "errto_string"
to_string.cpp: In function 'int main()':
to_string.cpp:6:16: error: 'to_string' is not a member of 'std'

Preliminary note: you do not need to call this function to put an integer into a [f|string]stream. std::to_string is only useful if you need the std::string object for something else later.

The function was not available on MinGW-w64 before GCC 4.8 (4.7.3pre?) and without current MinGW-w64 trunk. JonY made the necessary changes not so long ago. Why there was never a simple fallback in libstdc++ that used a temporary std::stringstream is beyond me though. This is what you can do if it's not available:

http://liveworkspace.org/code/3PIOlS$5

The stringstream is not as efficient as a decent implementation based on some printf or manual processing, but as libstdc++ relies on POSIX printf and JonY only fixed that stuff in MinGW-w64 trunk and some as-of-yet unreleased GCC version (4.7.3? and 4.8), this is a valid workaround.

Also: use <cstdint> instead of <stdint.h> (see link above).

Cheers,

Ruben
 
 
-------------
Jim Michaels
Jmichae3@yahoo.com
JimM@RenewalComputerServices.com
http://RenewalComputerServices.com
http://JesusnJim.com (my personal site, has software)
---
IEC Units: Computer RAM & SSD measurements, microsoft disk size measurements (note: they will say GB or MB or KB or TB when it is IEC Units!):
[KiB] [MiB] [GiB] [TiB]
[2^10B=1,024^1B=1KiB]
[2^20B=1,024^2B=1,048,576B=1MiB]
[2^30B=1,024^3B=1,073,741,824B=1GiB]
[2^40B=1,024^4B=1,099,511,627,776B=1TiB]
[2^50B=1,024^5B=1,125,899,906,842,624B=1PiB]
SI Units: Hard disk industry disk size measurements:
[KB] [MB] [GB] [TB]
[10^3B=1,000B=1KB]
[10^6B=1,000,000B=1MB]
[10^9B=1,000,000,000B=1GB]
[10^12B=1,000,000,000,000B=1TB]
[10^15B=1,000,000,000,000,000B=1PB]


------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public