-
Notifications
You must be signed in to change notification settings - Fork 4
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
find() is pretty broken #1
Comments
penberg
added a commit
to penberg/ujson
that referenced
this issue
May 17, 2020
When building on Fedora Linux 30, ujson_test link fails with the following error: /usr/bin/ld: CMakeFiles/ujson_test.dir/test.cpp.o: in function `std::thread::thread<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<____C_A_T_C_H____T_E_S_T____836()::{lambda()awangk#1}> >, void>::_Async_state_impl(std::tuple<____C_A_T_C_H____T_E_S_T____836()::{lambda()awangk#1}>&&)::{lambda()awangk#1}, , void>(std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<____C_A_T_C_H____T_E_S_T____836()::{lambda()awangk#1}> >, void>::_Async_state_impl(std::tuple<____C_A_T_C_H____T_E_S_T____836()::{lambda()awangk#1}>&&)::{lambda()awangk#1}&&)': test.cpp:(.text+0x1b51f): undefined reference to `pthread_create' collect2: error: ld returned 1 exit status Let's add the CMake's threads library (which maps to "-lpthread") to ujson_test to fix linking on Linux.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ujson::find() is simply a wrapper around std::lower_bound, so it will almost always claim to find the key you are looking for, unless you pass a name that is less than all other keys.
Sorry for not submitting an official pull request, but the fix is pretty obvious. You need to do something like this:
The text was updated successfully, but these errors were encountered: