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

No matching function for call to 'input_adapter' under Xcode of with nlohmann version 3.9.1 #2412

Closed
qcq opened this issue Oct 1, 2020 · 2 comments
Labels
kind: bug state: needs more info the author of the issue needs to provide more details state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated

Comments

@qcq
Copy link

qcq commented Oct 1, 2020

OS version: macOS High Sierra version 10.13.6
Xcode : Version 10.0 (10A255)
in my demo code just include the header
#include <nlohmann/json.hpp>

after click the build button, will has below issue:

/usr/local/include/nlohmann/json.hpp:9853:26: No matching function for call to 'input_adapter'
/Users/qinchuanqing/Code/workspace/C++/C++/main.cpp:9:10: In file included from /Users/qinchuanqing/Code/workspace/C++/C++/main.cpp:9:
/usr/local/include/nlohmann/json.hpp:5106:27: Candidate function not viable: no known conversion from 'std::__1::vector<char, std::__1::allocator<char> >' to 'std::FILE *' (aka '__sFILE *') for 1st argument
/usr/local/include/nlohmann/json.hpp:5111:29: Candidate function not viable: no known conversion from 'std::__1::vector<char, std::__1::allocator<char> >' to 'std::istream &' (aka 'basic_istream<char> &') for 1st argument
/usr/local/include/nlohmann/json.hpp:5116:29: Candidate function not viable: no known conversion from 'std::__1::vector<char, std::__1::allocator<char> >' to 'std::istream' (aka 'basic_istream<char>') for 1st argument
/usr/local/include/nlohmann/json.hpp:5096:6: Candidate template ignored: substitution failure [with ContainerType = std::__1::vector<char, std::__1::allocator<char> >]: call to 'begin' is ambiguous
/usr/local/include/nlohmann/json.hpp:5131:32: Candidate template ignored: requirement 'std::is_pointer<vector<char, allocator<char> > >::value' was not satisfied [with CharT = std::__1::vector<char, std::__1::allocator<char> >]
/usr/local/include/nlohmann/json.hpp:5139:6: Candidate template ignored: could not match 'T [N]' against 'std::__1::vector<char, std::__1::allocator<char> >'
/usr/local/include/nlohmann/json.hpp:5088:69: Candidate function template not viable: requires 2 arguments, but 1 was provided

I check the code, which the code just to change the vector to string

update the code to below:

        std::string string_format;
        for (std::size_t i = 0; i < size; ++i)
        {
            get();
            if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::ubjson, "number")))
            {
                return false;
            }
            number_vector.push_back(static_cast<char>(current));
            string_format += std::string(current);
        }

        // parse number string
        auto number_ia = string_format;

which can work.

@qcq qcq added the kind: bug label Oct 1, 2020
@nlohmann
Copy link
Owner

nlohmann commented Oct 1, 2020

What is the actual code you try to compile?

@nlohmann nlohmann added the state: needs more info the author of the issue needs to provide more details label Oct 1, 2020
@stale
Copy link

stale bot commented Dec 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug state: needs more info the author of the issue needs to provide more details state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated
Projects
None yet
Development

No branches or pull requests

2 participants