[Bug c++/61580] New: stoi function unknown on W7/Cygwin/x86_64

zosrothko at orange dot fr gcc-bugzilla@gcc.gnu.org
Sat Jun 21 12:02:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61580

            Bug ID: 61580
           Summary: stoi function unknown on W7/Cygwin/x86_64
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zosrothko at orange dot fr

Hello

The following program
$ cat stoi.cpp
#include <string>

int main()
{
   std::string s = "123";
   int i = std::stoi(s);
}

does not compile on a W7/Cygwin/x86_64 platform. here the log
$ g++ -v stoi.cpp
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with:
/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.3-2/src/gcc-4.8.3/configure
--srcdir=/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.3-2/src/gcc-4.8.3
--prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var
--sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share
--docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C
--build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin
--without-libiconv-prefix --without-libintl-prefix --enable-shared
--enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs
--enable-bootstrap --disable-__cxa_atexit --with-dwarf2 --with-tune=generic
--enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite
--enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm
--enable-libquadmath --enable-libquadmath-support --enable-libssp
--enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers
--with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as
--with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix
--without-libintl-prefix --with-system-zlib --libexecdir=/usr/lib
Thread model: posix
gcc version 4.8.3 (GCC)
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/cc1plus.exe -quiet -v -Dunix -idirafter
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../lib/../include/w32api
-idirafter ../../include/w32api stoi.cpp -quiet -dumpbase stoi.cpp
-mtune=generic -march=x86-64 -auxbase stoi -version -o /tmp/ccZYgiXq.s
GNU C++ (GCC) version 4.8.3 (x86_64-pc-cygwin)
        compiled by GNU C version 4.8.3, GMP version 6.0.0, MPFR version 3.1.2,
MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/include"
ignoring nonexistent directory "../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include/c++
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include/c++/x86_64-pc-cygwin
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include/c++/backward
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include
 /usr/local/include
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include-fixed
 /usr/include
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../lib/../include/w32api
End of search list.
GNU C++ (GCC) version 4.8.3 (x86_64-pc-cygwin)
        compiled by GNU C version 4.8.3, GMP version 6.0.0, MPFR version 3.1.2,
MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 636b2526cba54f47bd98b825d7c95d49
stoi.cpp: In function 'int main()':
stoi.cpp:6:12: error: 'stoi' is not a member of 'std'
    int i = std::stoi(s);
            ^


IMHO? the problem should come from the basic_string.h include where the
definition of stoi is guarded by
#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
     && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))

and _GLIBCXX_USE_C99 is not defined 

FrancisANDRE@idefix /lib/gcc/x86_64-pc-cygwin/4.8.3/include/c++/bits
$ g++ -xc++ -std=gnu++11 -dM -E - < /dev/null | sort | grep _GLIB

FrancisANDRE@idefix /lib/gcc/x86_64-pc-cygwin/4.8.3/include/c++/bits
$ g++ -xc++ -std=c++11 -dM -E - < /dev/null | sort | grep _GLIB

Rgds



More information about the Gcc-bugs mailing list