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

json::parse of std::string being underlined by Visual Studio #402

Closed
Noitidart opened this issue Dec 21, 2016 · 6 comments
Closed

json::parse of std::string being underlined by Visual Studio #402

Noitidart opened this issue Dec 21, 2016 · 6 comments

Comments

@Noitidart
Copy link

This was just a nit pick. I don't know why but it keeps underlining my json::parse from strings. I use json::parse on varaibles like this:

	void listenMain(std::string payload_str) {
            json payload = json::parse(payload_str);

This compiles, but it gets underlined by visual studio like this:

Do you know why this is? It works fine. Is there a way to properly use json::parse with variables?

Thank you!

@gregmarr
Copy link
Contributor

The compiler used by Intellisense is not the same as the compiler used to build the program. The Intellisense compiler doesn't always have all the information it needs to figure out whether something is valid or not, unfortunately. As long as the program compiles, you'd need to report this Intellisense failure to Microsoft.

@Noitidart
Copy link
Author

Ah interesting @gregmarr thanks for sharing that! I'll do some research and see if I can fix it. Will report back what I find. :)

@nlohmann
Copy link
Owner

Thanks @Noitidart. I shall close this issue in the meantime as there is nothing we can do about it.

@Noitidart
Copy link
Author

Makes total sense thanks for telling me before closing. :)

@Noitidart
Copy link
Author

Hey all, I found a weird fix for this silly issue. If I do .c_str() it doesnt underline it. It makes no sense to me. Does this make sense to anyone?

  json payload = json::parse(payload_str.c_str());

@nlohmann
Copy link
Owner

nlohmann commented Jan 1, 2017

@Noitidart Thanks for checking back!

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

3 participants