1

我正在尝试制作一个使用来自网站的 Json 的程序,但我似乎遇到了这个问题:

std::ifstream ifile("json.txt");
Json::Reader reader;
Json::Value root;
if (ifile != NULL && reader.parse(ifile, root)) {
    const Json::Value arrayDest = root["dest"];
    for (unsigned int i = 0; i < arrayDest.size(); i++) {
        if (!arrayDest[i].isMember("name"))
        continue;
        std::string out;
        out = arrayDest[i]["name"].asString();
        std::cout << out << "\n";
    }
}

我已将问题范围缩小到该行 Json::Reader reader;

它给了我一个错误:

调试断言... _pFirstBlock == pHead

我正在使用 jsoncpp

4

1 回答 1

1

这不是 JsonCpp 错误;pHeadJsonCpp 源代码中没有出现。从简短的 Google 搜索来看,它看起来像是Microsoft Visual C++ 运行时库中报告的错误,由在使用 DLL 时分配内存的位置和释放内存的位置之间的不匹配触发,或者正在使用的 C 运行时版本之间不匹配,或在如何链接 C 运行时之间。

于 2014-06-15T20:51:01.440 回答