Issue
I was previously developing in python and now I've switched to C++. I found a cool library called CPR https://github.com/whoshuu/cpr that can be used to make HTTP requests easily like python requests. Like in python there are no easy pkg managers like pip to install libraries in C++. How can I use cpr in my project. There are no dlls or lib file in that.
Solution
c++ packages are usually distributed as a set of development headers and static/shared libraries. However in the case of cpr
, the documentation recommends to use submodules to get the functionality into your project.
As cpr
uses cmake
, I would also expect this to be possible (although not documented):
$ git clone https://github.com/whoshuu/cpr.git
$ cd cpr
$ mkdir build && cd build
$ cmake ..
$ make
$ make install
Then cpr
will be available in your system (as long as make install
copies the built libraries and development headers to system-wide location). In your project, you will be able to include cpr
like so:
#include <cpr/cpr.h>
And build it like so:
g++ -std=c++11 -o main -lcpr main.cpp
Answered By - Jon
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.