Skip to content

undefined reference to `nlohmann::json_schema::json_validator::json_validator #339

@rbahegne

Description

@rbahegne

Hello,

I'm trying to use json-schema-validator with Cmake for several days now but i'm stuck on undefined reference for the json_validator, at first i thought it was a linking issue.

This piece of cmake code

find_package(nlohmann_json_schema_validator REQUIRED)
if(TARGET nlohmann_json_schema_validator::validator)
    message("nlohmann_json_schema_validator")
endif()

Finally convince that indeed the target name was nlohmann_json_schema_validator::validator and not just nlohmann_json_schema_validator as stated in the Readme.

But it did not solve my problem, the other strange thing that convinced my that it was no linking issue is that this line compile correctly :
nlohmann::json_schema::basic_error_handler handler;

So i guess the nlohmann_json_schema_validator is properly found and link (right ?).

But this one
nlohmann::json_schema::json_validator validator
Does not

I also tried with another ctor :
nlohmann::json_schema::json_validator validator(loader, nlohmann::json_schema::default_string_format_check);

With the same result :

undefined reference to `nlohmann::json_schema::json_validator::json_validator(std::function<void (nlohmann::json_uri const&, nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >&)>, std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>, std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&)>)'
collect2: error: ld returned 1 exit status

Any ideas ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions