[try Beta version]
Not logged in

 
stoul how does it work??

May 23, 2013 at 11:50am
how exactly does stoul work.

1
2
3
  unsigned long x;
  x = std::stoul(result);


but i get the error
 
a3_p1.cpp:57: error: âstoulâ is not a member of âstdâ


what am i missing?
May 23, 2013 at 11:54am
a) Do you have C++11 compliant compiler? Does it set to C++11 mode?
b) Did you #include <string> ?
May 23, 2013 at 11:59am
I am a noob at this, so not exactly sure what you are asking in a), but yea i do have #include<string>
Last edited on May 23, 2013 at 11:59am
May 23, 2013 at 12:01pm
if i remove the std before the stoul like :
x = stoul(result);
then i get the error
a3_p1.cpp:57: error: âstoulâ was not declared in this scope
May 23, 2013 at 12:05pm
What IDE do you use? MSVS? If so, what version.
May 23, 2013 at 12:07pm
I am actually using Putty to connect to my uni linux server, and i am using g++ as my compiler.
May 23, 2013 at 12:55pm
Ok, try to compile with -std=c++0x parameter
May 23, 2013 at 1:04pm
Or -std=c++11, depending on the version of g++.
Topic archived. No new replies allowed.