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

How can i build this library in VS 2017? #1943

Closed
dota17 opened this issue Feb 13, 2020 · 2 comments
Closed

How can i build this library in VS 2017? #1943

dota17 opened this issue Feb 13, 2020 · 2 comments

Comments

@dota17
Copy link
Contributor

dota17 commented Feb 13, 2020

  • Describe what you want to achieve.
    I know i can use single_include in my project, but i want to build and test this library in VS 2017, especially i add my code.

  • Describe what you tried.
    In VS 2017, i open this library as CMake Project with File - Open - CMake....
    And then, CMake - Build All.

But i got these error:

.\json-develop\test\src\unit-udt.cpp : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss 
.\json-develop\test\src\unit-udt.cpp(115): error C2001: newline in constant 
.\json-develop\test\src\unit-udt.cpp(202): error C2001: newline in constant 
.\json-develop\test\src\unit-udt.cpp(276): error C2672: 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::get': no matching overloaded function found 
.\json-develop\test\src\unit-udt.cpp(276): error C2783: 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer> nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::get(void) const': could not deduce template argument for '__formal' 
    .\json-develop\single_include\nlohmann\json.hpp(17101): note: see declaration of 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::get'
.\json-develop\test\src\unit-udt.cpp(276): error C2789: 'parsed_book': an object of const-qualified type must be initialized 
    .\json-develop\test\src\unit-udt.cpp(276): note: see declaration of 'parsed_book'
.\json-develop\test\src\unit-udt.cpp(279): error C2672: 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::get': no matching overloaded function found 
.\json-develop\test\src\unit-udt.cpp(279): error C2783: 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer> nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::get(void) const': could not deduce template argument for '__formal' 
    .\json-develop\single_include\nlohmann\json.hpp(17101): note: see declaration of 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::get'
.\json-develop\test\src\unit-udt.cpp(278): error C2789: 'contacts': an object of const-qualified type must be initialized 
    .\json-develop\test\src\unit-udt.cpp(278): note: see declaration of 'contacts'
.\json-develop\test\src\unit-udt.cpp(281): error C2672: 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::get': no matching overloaded function found 
.\json-develop\test\src\unit-udt.cpp(281): error C2783: 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer> nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::get(void) const': could not deduce template argument for '__formal' 
    .\json-develop\single_include\nlohmann\json.hpp(17101): note: see declaration of 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::get'

Also, these error is similar to #664 (comment)

  • Describe which system (OS, compiler) you are using.
    Windows 10

  • Describe which version of the library you are using (release version, develop branch).
    -- Building for: Visual Studio 15 2017
    -- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18362.
    -- The CXX compiler identification is MSVC 19.16.27035.0

@nlohmann
Copy link
Owner

We build with MSVC 2017 in the CI, see https://ci.appveyor.com/project/nlohmann/json/builds/30517983. So there should not be any problem.

@nlohmann nlohmann added the platform: visual studio related to MSVC label Feb 14, 2020
@dota17
Copy link
Contributor Author

dota17 commented Feb 27, 2020

Solve. If anyone has same issue, please ensure

1. install mingw
2. download ninja from https://github.com/ninja-build/ninja/releases/download/v1.6.0/ninja-win.zip
3. follow the scripts of appveyor.yml

finally, you can get nlohmann_json_sln.
Open it, modify code and then rebuild in VS 2017.

@dota17 dota17 closed this as completed Feb 27, 2020
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

2 participants