I have been using stoi to convert string representation of numbers
into int since long. Only recently one such program of mine stopped
working giving following error:
string_int.cpp: In function 'int main(int, char**)':
string_int.cpp:29: error: 'stoi' is not a member of 'std'
Here is the code snippet:
std::string newValStr = "777;
int newValInt = 0;
newValInt = std::stoi(newValStr);
I looked around internet and there doesn't seem to be any update on
it. I am compiling it using g++ on Redhat Linux 6.2 with following
gcc version:
gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)
Has anyone else also faced something similar?
Em quarta-feira, 4 de novembro de 2015 11:00:50 UTC-2, kiran escreveu:code.
I have been using stoi to convert string representation of numbers intoint
since long. Only recently one such program of mine stopped working givingam
following error:
string_int.cpp: In function 'int main(int, char**)':
string_int.cpp:29: error: 'stoi' is not a member of 'std'
Here is the code snippet:
std::string newValStr = "777;
int newValInt = 0;
newValInt = std::stoi(newValStr);
I looked around internet and there doesn't seem to be any update on it. I
compiling it using g++ on Redhat Linux 6.2 with following gcc version:
gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)
Has anyone else also faced something similar?
Are you including the <string> header? End there is a missing " in the
Anyway, if you would like an advise, I'd recommend you to useistringstream
and operator >> in order to perform tihs conversion in a more C++ish way.
Best,
Elias.
I have been using stoi to convert string representation of numbers intoint
since long. Only recently one such program of mine stopped working giving following error:am
string_int.cpp: In function 'int main(int, char**)':
string_int.cpp:29: error: 'stoi' is not a member of 'std'
Here is the code snippet:
std::string newValStr = "777;
int newValInt = 0;
newValInt = std::stoi(newValStr);
I looked around internet and there doesn't seem to be any update on it. I
compiling it using g++ on Redhat Linux 6.2 with following gcc version:
gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)
Has anyone else also faced something similar?
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 35:49:05 |
| Calls: | 12,109 |
| Files: | 15,006 |
| Messages: | 6,518,357 |