-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Description
Describe the bug
After #1584 jsoncpp supports either C++11, if jsoncpp was compiled with C++11 standard or C++17 and later (no C++11) if compiled with ie C++17. That's because symbols in library are exclusive:
jsoncpp/src/lib_json/json_value.cpp
Lines 1193 to 1224 in 3455302
| #ifdef JSONCPP_HAS_STRING_VIEW | |
| const Value& Value::operator[](std::string_view key) const { | |
| Value const* found = find(key.data(), key.data() + key.length()); | |
| if (!found) | |
| return nullSingleton(); | |
| return *found; | |
| } | |
| Value& Value::operator[](std::string_view key) { | |
| return resolveReference(key.data(), key.data() + key.length()); | |
| } | |
| #else | |
| const Value& Value::operator[](const char* key) const { | |
| Value const* found = find(key, key + strlen(key)); | |
| if (!found) | |
| return nullSingleton(); | |
| return *found; | |
| } | |
| Value const& Value::operator[](const String& key) const { | |
| Value const* found = find(key); | |
| if (!found) | |
| return nullSingleton(); | |
| return *found; | |
| } | |
| Value& Value::operator[](const char* key) { | |
| return resolveReference(key, key + strlen(key)); | |
| } | |
| Value& Value::operator[](const String& key) { | |
| return resolveReference(key.data(), key.data() + key.length()); | |
| } | |
| #endif |
To Reproduce
Steps to reproduce the behavior:
- Compile jsoncpp with ie C++20
- Try to compile and link following code with C++11
#include <json/json.h>
int main() {
Json::Value v;
v["test"];
}- Build fails on linking:
test.c:(.text+0x28): undefined reference to `Json::Value::operator[](char const*)'
Expected behavior
Build succeeds.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels