H
H
habra_dude2022-02-02 00:13:02
CMake
habra_dude, 2022-02-02 00:13:02

How to connect the library in pluses?

There is a desire to master the pros and hello world example, I want to add the library https://github.com/libcpr/cpr to it . Could you explain to me what steps you need to take to import this library and it could be called in the fnc function.

The Readme on github has:
- If you already have a CMake project you need to integrate C++ Requests with, the primary way is to use `fetch_content`.
Add the following to your `CMakeLists.txt`.
- Building cpr - Using vcpkg
- Building cpr - Using Conan

I have windows and mingw-make. I would like to have fewer additional packages and dependencies. And so that the sorts lie side by side with respect to main.cpp, with the possibility of editing them.

void fnc(){
    cpr::Response r = cpr::Get(cpr::Url{"https://api.github.com/repos/whoshuu/cpr/contributors"},
                      cpr::Authentication{"user", "pass"},
                      cpr::Parameters{{"anon", "true"}, {"key", "value"}});
    r.status_code;                  // 200
    r.header["content-type"];       // application/json; charset=utf-8
    r.text;
}

int main() {
    std::cout << "Hello World!";
    fnc();
    return 0;

}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Turnaviotov, 2022-02-02
@foxmuldercp

cmake is a must have as a code editor. This is a Makefile generator for the project so that make can then build them.
so put

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question