cpr
cpr copied to clipboard
Is there a way to build and add the `cpr` lib without CMake or any package manager ?
Is there a way to build and add the cpr lib without CMake or any package manager ?
I ran the following commands as per README:
$ sudo apt install -y libcurl4-openssl-dev
$ git clone https://github.com/libcpr/cpr.git
$ cd cpr && mkdir build && cd build
$ cmake .. -DCPR_USE_SYSTEM_CURL=ON
$ cmake --build .
$ sudo cmake --install .
So created the client.cpp file:
#include <cpr/cpr.h>
int main() {
cpr::Response r = cpr::Get(cpr::Url{"http://www.httpbin.org/get"},
cpr::Parameters{{"hello", "world"}});
return 0;
}
And built it:
g++ -std=c++20 client.cpp -lcpr -lcurl -o client_bin
But when I run .\client_bin I get the error:
./client_bin: error while loading shared libraries: libcpr.so.1: cannot open shared object file: No such file or directory
How can I use this project without relaying on CMake or any package manager ?
OS: Ubuntu 22.04 GCC version: 11.3.0
This was apparently resolved by running ldconfig.
https://stackoverflow.com/a/13132584
@ssantos21 I'm glad you solved it! Using ldconfig is something we should document. I will keep this issue open until we have done so.
Thanks for reporting.