Skip to content

error: static_assert failed #573

Closed
Closed

Description

I got this error when I built my application.

/json.hpp:843:9: error: static_assert failed "could not find to_json() method       in T's namespace"         static_assert(sizeof(BasicJsonType) == 0

Activity

  1. nlohmann commented on May 5, 2017

    @nlohmann
    Owner

    This error occurs if you try to assign an unsupported type to json, e.g.

    MyClass foo;
    json j = foo;

    The second line tries to find a way to convert MyClass to json and does this by searching for a to_json function in the namespace of the class (see https://github.com/nlohmann/json#arbitrary-types-conversions for more information).

    Without more context of your program, I'm afraid I cannot help more.

  2. nlohmann commented on May 5, 2017

    @nlohmann
    Owner

    @SpilledMango Any news on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions