[DragonFlyBSD - Bug #2734] c++11 is missing stoi
bugtracker-admin at leaf.dragonflybsd.org
bugtracker-admin at leaf.dragonflybsd.org
Thu Nov 13 13:23:00 PST 2014
Issue #2734 has been updated by swildner.
Pierre,
I don't have a fix but here's why.
In contrib/gcc-4.7/libstdc++-v3/include/bits/basic_string.h we find:
---------
#if (defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(_GLIBCXX_USE_C99) \
&& !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
#include <ext/string_conversions.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// 21.4 Numeric Conversions [string.conversions].
inline int
stoi(const string& __str, size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa<long, int>(&std::strtol, "stoi", __str.c_str(),
__idx, __base); }
...
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif /* __GXX_EXPERIMENTAL_CXX0X__ && _GLIBCXX_USE_C99 ... */
---------
__GXX_EXPERIMENTAL_CXX0X__ is defined, _GLIBCXX_HAVE_BROKEN_VSWPRINTF isn't, so we're clear regarding those two. However, _GLIBCXX_USE_C99 isn't defined, but it's needed for stoi() and various other functions.
>From libstdc++-v3's configure output:
checking for ISO C99 support in <complex.h>... no
checking for ISO C99 support in <stdio.h>... yes
checking for ISO C99 support in <stdlib.h>... yes
checking for ISO C99 support in <wchar.h>... yes
checking for fully enabled ISO C99 support... no
Compiling the associated conftest for complex.h gives this:
complex.c:(.text+0x19b): undefined reference to `clogf'
complex.c:(.text+0x3e6): undefined reference to `cpowf'
complex.c:(.text+0x65d): undefined reference to `clog'
complex.c:(.text+0x8db): undefined reference to `cpow'
complex.c:(.text+0xa0c): undefined reference to `ccosl'
complex.c:(.text+0xa7c): undefined reference to `ccoshl'
complex.c:(.text+0xaec): undefined reference to `cexpl'
complex.c:(.text+0xb5c): undefined reference to `clogl'
complex.c:(.text+0xbcc): undefined reference to `csinl'
complex.c:(.text+0xc3c): undefined reference to `csinhl'
complex.c:(.text+0xd1c): undefined reference to `ctanl'
complex.c:(.text+0xd8c): undefined reference to `ctanhl'
complex.c:(.text+0xe2a): undefined reference to `cpowl'
So it seems we need these functions first before we could enable _GLIBCXX_USE_C99 which would then cause stoi() to be present.
Regards,
Sascha
----------------------------------------
Bug #2734: c++11 is missing stoi
http://bugs.dragonflybsd.org/issues/2734#change-12285
* Author: phma
* Status: New
* Priority: Normal
* Assignee:
* Category: Build
* Target version: 4.0.x
----------------------------------------
$ g++ --std=c++11 -o stoitest stoitest.cpp
stoitest.cpp: In function 'int main(int, char**)':
stoitest.cpp:18:15: error: 'stoi' was not declared in this scope
This program compiles and runs on Ubuntu Linux, using g++ 4.8.2. It produces the above error on DragonFly BSD, both using the g++ 4.7.4 in world and using g++ 4.8.3 installed as a package.
---Files--------------------------------
stoitest.cpp (359 Bytes)
--
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
More information about the Bugs
mailing list