Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: static_assert failed #573

Closed
ghost opened this issue May 4, 2017 · 3 comments
Closed

error: static_assert failed #573

ghost opened this issue May 4, 2017 · 3 comments

Comments

@ghost
Copy link

ghost commented May 4, 2017

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
@nlohmann
Copy link
Owner

nlohmann commented May 5, 2017

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:/nlohmann/json#arbitrary-types-conversions for more information).

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

@nlohmann
Copy link
Owner

nlohmann commented May 5, 2017

@SpilledMango Any news on this?

@ghost
Copy link
Author

ghost commented May 5, 2017

No, it's fine.

@nlohmann nlohmann closed this as completed May 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant