我在使用 gcc5.4.0 在大型项目上运行 make 时遇到了这个错误。
/usr/include/c++/5/sstream:300:14: error: '__xfer_bufptrs' redeclared with 'public' access
struct __xfer_bufptrs
^
/usr/include/c++/5/sstream:67:14: note: previously declared 'private' here
struct __xfer_bufptrs;
对我来说,这似乎是编译器的问题?由于问题出现在标准 c++ 库 sstream 中?这对我来说没有意义,我是否使用了错误的编译器?
以下是错误消息引用的代码片段:
1.) sstream 从第 67 行开始
class basic_stringbuf : public basic_streambuf<_CharT, _Traits>
{
struct __xfer_bufptrs;
public:
2.) sstream 在第 300 行
#if _GLIBCXX_USE_CXX11_ABI
// This type captures the state of the gptr / pptr pointers as offsets
// so they can be restored in another object after moving the string.
struct __xfer_bufptrs
{
__xfer_bufptrs(const basic_stringbuf& __from, basic_stringbuf* __to)
: _M_to{__to}, _M_goff{-1, -1, -1}, _M_poff{-1, -1, -1}
{
我知道标准库不可能有任何问题,那为什么会抛出错误?
这是我得到的最接近的答案: https ://github.com/PacificBiosciences/pbbam/issues/14
似乎答案围绕着这些“Dprivate”和“Dpublic”标志。我假设是编译器标志,但我不确定它们是做什么的。