我在使用 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.) 第 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 https://github.com/PacificBiosciences/pbbam/issues/14
答案似乎围绕着这些“Dprivate”和“Dpublic”标志。我认为是编译器标志,但我不确定它们的作用。