在VS2008中编译boost property_tree会产生致命错误C1001

时间:2014-09-12 02:54:30

标签: c++ visual-studio-2008 boost

这里是VS2008在windows7下编译的代码,

using boost::property_tree::ptree;
ptree   pt;

pt.add("License.Unalterable.Signed.Guid", m_Guid);
pt.add("License.Unalterable.Signed.CustomerId", m_CustomerId);
pt.add("License.Unalterable.Signed.Name", m_Name);
pt.add("License.Unalterable.Signed.Version", m_version);

std::ostringstream oss;
write_xml(oss, pt); // error happened on this function

然后VS2008给出错误C1001: An internal error has occurred in the compiler

错误详情如下:

Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: cl.exe
  Application Version:  15.0.30729.1
  Application Timestamp:    488ef6ea
  Fault Module Name:    c1xx.dll
  Fault Module Version: 15.0.30729.1
  Fault Module Timestamp:   488f296d
  Exception Code:   c0000005
  Exception Offset: 0004a085
  OS Version:   6.1.7601.2.1.0.256.4
  Locale ID:    1033

搜索此问题后,找到一个link,但我还没有找到修复程序。

1 个答案:

答案 0 :(得分:0)

这个问题无法回答。

首先,ICE总是存在错误,应该报告给编译器供应商,而不是堆栈溢出。

其次,您的代码不完整。显然,我们无法编译您的代码并期望得到相同的错误(即使没有帮助)。

所以,这是我在黑暗中的镜头:你是#include <sstream> 吗?

查看 Live On Coliru

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <sstream>

int main()
{
    using boost::property_tree::ptree;
    ptree   pt;

    std::string m_Guid, m_CustomerId, m_Name, m_version;

    pt.add("License.Unalterable.Signed.Guid", m_Guid);
    pt.add("License.Unalterable.Signed.CustomerId", m_CustomerId);
    pt.add("License.Unalterable.Signed.Name", m_Name);
    pt.add("License.Unalterable.Signed.Version", m_version);

    std::ostringstream oss;
    write_xml(oss, pt);
}