g++ cannot find std::stoi

hhh at sdf.org hhh at sdf.org
Wed May 28 23:32:07 UTC 2014


Hi,

I'm trying to compile OpenCog [1] using g++47, but get an error about
missing std::stoi.

I have attached a micro-example [2] that generates the same error, if I
try to compile it with:

% g++47 -std=c++11 s.cc
s.cc: In function 'int main()':
s.cc:8:13: error: 'stoi' is not a member of 'std'


There are no problems neither with clang nor with g++ on Debian:

% clang++ -std=c++11 s.cc



What am I missing?


Henryk




[1] http://opencog.org/
[2] cat s.cc

#include <iostream>
#include <string>

using namespace std;

int main(){
  string theAnswer = "42";
  int ans = std::stoi(theAnswer, 0, 10);

  cout << "The answer to everything is " << ans << endl;
}


More information about the freebsd-ports mailing list