Show the code where you tried to use the function and post the complete error message exactly as they appear in your development environment.
Jim
Show the code where you tried to use the function and post the complete error message exactly as they appear in your development environment.
Jim
This is where I am trying it, 'ask' is being read from a text file and as written it works as it should, if I uncomment the line and comment out the istringstream line instead I get the following error:Code:getline(jcin, ask, '#'); //rg = stoi(ask); istringstream (ask)>>rg; cout<<endl<<endl<<"Players rapid play grade : "<<rg;
error : 'stoi' was not declared in this scope
Then I would say your compiler doesn't support that feature. Stick to the stringstream solution. Or use atoi()
JimCode:rg=atoi(ask.c_str());
Hi Elysia, do you mean the full 550 program or just the function?
That is what I did with the snippet I posted above, it works as it should using 'istringstream' but not if you use 'stoi'
Probably not worth going further with this, I think Jim may well be right that my ompiler doen's have that functionality yet; I will have to look at upgrading but hven't a clue how to go about it! Do you think if I uninstalled Code::Blocks and re-installed the latest cersion that would do it? I am using v10.05. I know that is only the IDE but it installed gcc/mingw along with it when I first installed it.
No. Go explore for mingw in your c::b directory.
When you find it, go download latest mingw and install it into that directory (it would be called mingw or something).
OK, so let me rephrase what I said above:
Show us the smallest possible compilable example that reproduces the issue.
No that "snippet" will not compile as presented. You need to have at least a function main() to have a complete program, along with at least a couple of include files.That is what I did with the snippet I posted above, it works as it should using 'istringstream' but not if you use 'stoi'
Jim
Is that "4.5.6" or "4.5 or 4.6"? My copy of g++ 4.6.3 comes with a standard library implementation that does have std::stoi.Originally Posted by JayCee++
EDIT:
Wait, there is no 4.5.6, yet.
Last edited by laserlight; 07-03-2012 at 11:57 AM.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
After retesting with g++ version 4.5.2 and insuring the -std=c++0x was selected stoi() was properly recognized.
Jim
Last edited by jimblumberg; 07-03-2012 at 11:58 AM.
The latest mingw is 4.7 as far as I can make out and I appreciate this is probably not the right place to ask but can anyone tell me where to download an installable copy for windows and how to relace the version I have. I looked on google but only seem to be able to find tar files which I don't know what to do with?
Grab the installer: Download MinGW - Minimalist GNU for Windows from SourceForge.net
(Assuming windows.)
Another MinGW-Like GCC is TDM build of MinGW GCC; version 4.6.1 is the newest on the site.
TDM-GCC
Tim S.
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson