g++ cannot find std::stoi

Lowell Gilbert freebsd-ports-local at be-well.ilk.org
Thu May 29 19:19:33 UTC 2014

hhh at sdf.org writes:

> 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?

An old libc++ bug in gcc.

You need a newer compiler. 

The default compiler on recent (I think 10.0 and up) is a version of
clang that will get this right.

More information about the freebsd-ports mailing list