3

最近我需要使用 boost TCP iostream,所以我一直在尝试使用 Ubuntu 12.04 和 MSVC 11.0 (Visual Studio 2012) 上的 g++ 4.6 的 boost (v1.50.0) 异步 I/O的 iostream示例编译日间服务器客户端RC)在 Windows 7 上。程序在 Linux 上按预期编译和运行。从中我们可以推断出boost示例的源代码是完全正确的,所以我不在这里简称。此外,所有 MSVC 项目设置和 boost 二进制文件的链接都可以,因为它编译得很好,只有警告 C4250根据微软的说法是好的。

问题是服务器和客户端都在 Windows 上运行时崩溃,并且错误看起来像0x000007FEEE9082DE (msvcp110d.dll) (***.exe) unhandled exception: 0xC00000FD: Stack overflow (arguement: 0x0000000000000001, 0x00000000000C3FF0)在调试中。

当我离开服务器运行后台并调试客户端时,堆栈跟踪 在此处输入图像描述 显示了调用堆栈。我挖掘了 ostream 的源代码,发现在 in 的构造函数sentrybasic_ostream

explicit __CLR_OR_THIS_CALL sentry(_Myt& _Ostr)
        : _Sentry_base(_Ostr)
        {   // construct locking and testing stream
        if (_Ostr.good() && _Ostr.tie() != 0)
            _Ostr.tie()->flush();
        _Ok = _Ostr.good(); // store test only after flushing tie
        }

是否有电话_Ostr.tie()->flush()和定义flush()

_Myt& __CLR_OR_THIS_CALL flush()
    {   // flush output stream
    if (_Myios::rdbuf() != 0)
        {   // buffer exists, flush it
        const sentry _Ok(*this);

        if (_Ok && _Myios::rdbuf()->pubsync() == -1)
            _Myios::setstate(ios_base::badbit); // sync failed
        }
    return (*this);
    }

构造一个常量哨兵_Ok。我认为这是一个错误,但我不确定。

所以我的问题是,您认为这是 MSVC 11.0 运行时的错误吗?如果使用 MSVC 10.0 (Visual Studio 2010) 编译,服务器或客户端是否会出于同样的原因在您的 Windows 系统上崩溃?

4

0 回答 0