Skip to content

Cannot debug but Run works #2085

@hect1995

Description

@hect1995
  • Describe what you want to achieve.
    I want to check which is the result of the json::parse of a certain file. Whenever I compile and run I see that works if I try to access one field. On the other hand if in debug mode, it crashes in:

Captura de pantalla 2020-05-03 a las 18 38 36

  • Describe what you tried.
    My simple script is:
#include "nlohmann/json.hpp"
#include <fstream>
#include <iostream>

using json = nlohmann::json;

int main()
{
    std::ifstream myinput("dataset/CTA_Bay17.json");
    auto j = json::parse(myinput);
    // write prettified JSON to another file
    std::cout << j["array"] << "\n";
}

And the JSON I am reading is:

{
    "array": [
        1,
        2,
        3
    ],
    "boolean": true,
    "color": "gold",
    "null": null,
    "number": 123,
    "object": {
        "a": "b",
        "c": "d"
    },
    "string": "Hello World"
}
  • Describe which system (OS, compiler) you are using. Mac OS Catalina and LLDB

  • Describe which version of the library you are using (release version, develop branch).
    Master branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: questionstate: needs more infothe author of the issue needs to provide more detailsstate: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updated

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions