-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Linker error after string_view commit #1595
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
Comments
I am getting the same problem on MacOS. I can work around it by removing the check in json/value.h to always set JSONCPP_HAS_STRING_VIEW to 1 or A better fix is to modify CMakeLists.txt to set CMAKE_CXX_STANDARD to 17 (NOTE: setting it to 20 runs into problems with char8_t) |
Started messing around with this locally and was able to reproduce. This looks to me like a library version mismatch. If JsonCpp is compiled with C++11, but the example project is compiled with C++17, then this error reproduces for me locally. If the example project is compiled with C++11 as well, I don't receive this error. Being compatible with different versions of C++ is a big value add for JsonCpp, at least historically. I am reluctant to move to C++17 as a requirement in general. This bug shouldn't impact most production use cases, AFAIK. I think what is probably the best answer at this point is to ensure that the headers that get installed to the system actually match the library that get installed to the system. |
As One possible approach may be omitting |
I had the same problem on Ubuntu 24.04, but I set neither CMAKE_CXX_STANDARD nor JSONCPP_HAS_STRING_VIEW to solve the problem |
Describe the bug
Since commit 60ccc1f ("feat: support std::string_view in Value API"), simple example fails to linker error.
To Reproduce
Steps to reproduce the behavior:
CMakeLists.txt
main.cpp
cmake -B build-example example && cmake --build build-example
Expected behavior
Desktop (please complete the following information):
Additional context
"key"
tostd::string
,std::string_view
orchar*
constant does not resolve the issue.The text was updated successfully, but these errors were encountered: