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

basic_json has no member "parse" #1731

Closed
Ruud-cb opened this issue Aug 28, 2019 · 6 comments
Closed

basic_json has no member "parse" #1731

Ruud-cb opened this issue Aug 28, 2019 · 6 comments
Labels
platform: visual studio related to MSVC solution: invalid the issue is not related to the library

Comments

@Ruud-cb
Copy link

Ruud-cb commented Aug 28, 2019

  • What is the issue you have?

Copied the json.hpp file (v3.7.0) from release into my C++ project, the IDE (VS2019) instantly reports problems with 2 issues:

class "nlohmann:basic_json<std::map, std::vector, std::string, bool, int64_t, uint64_t, double, std::allocator, nlohmann:adl_serializer>" has no member "parse".

https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp#L22516

And one error I am a little bit less concerned about because I don't need it to parse a json:

class "nlohmann:basic_json<std::map, std::vector, std::string, bool, int64_t, uint64_t, double, std::allocator, nlohmann:adl_serializer>" has no member "swap".

https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp#L22495

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?
  1. Create a new C++ Dynamic Link Library Project in VS2019
  2. Add json.hpp
  3. See errors

Visual Studio 2019 (v142)
Also tried Visual Studio 2017 (v141) but that even gave me more issues.

  • Did you use a released version of the library or the version from the develop branch?

  • If you experience a compilation error: can you compile and run the unit tests?

FYI: I am a C++ noob

@Ruud-cb Ruud-cb changed the title basic_json has no member "parse basic_json has no member "parse" Aug 28, 2019
@t-b
Copy link
Contributor

t-b commented Aug 29, 2019

See https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a265a473e939184aa42655c9ccdf34e58.html#a265a473e939184aa42655c9ccdf34e58 for an example how to use the static parse method.

@nlohmann nlohmann added the solution: proposed fix a fix for the issue has been proposed and waits for confirmation label Aug 29, 2019
@kyeonghopark
Copy link

It seems just an error from Visual Studio IntelliSense, not an actual compiler.
Maybe a bug of IntelliSense?

@F0bes
Copy link

F0bes commented Sep 14, 2019

Visual Studio 2019 (16.2.5) suffers from the same IntelliSense bug, hoping for a fix soon.

@nlohmann nlohmann added the platform: visual studio related to MSVC label Sep 16, 2019
@nlohmann
Copy link
Owner

As the issue is not related to the library, but rather IntelliSense, I'm closing the issue.

@nlohmann nlohmann added solution: invalid the issue is not related to the library and removed kind: bug solution: proposed fix a fix for the issue has been proposed and waits for confirmation labels Sep 16, 2019
@asfarley
Copy link

asfarley commented Oct 7, 2019

For anyone still running into this, there's a workaround available. Add the following flag to 'Additional Options' under your project's Configuration Properties -> C/C++ -> Command Line options.

Zc:__cplusplus

Workaround

@monkey0506
Copy link

For anyone still running into this, there's a workaround available. Add the following flag to 'Additional Options' under your project's Configuration Properties -> C/C++ -> Command Line options.

I'm absolutely floored by the fact that this simple compiler switch actually makes IntelliSense play nicely with complex template code. It's much more pleasant than what I was doing before (stubbing the entire API inside of #ifdef __INTELLISENSE__ blocks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: visual studio related to MSVC solution: invalid the issue is not related to the library
Projects
None yet
Development

No branches or pull requests

7 participants