first of all, sorry if my english is not perfect, i’m not a native speaker.
i’ve never worked with cmake nor am i really proficient in c++. this is the first time i really wanted to use a library that was provided by someone else.
i cloned the cpr repository into my “base” directory using the git clone command.
i also created a build folder as described in the describtion of the github page and used cmake to build the library (?).
all of this worked out so far, but when i want to compile the project i get the error message “File or directory not found”.
i’m quite desperate since chatgpt wasnt able to help me out at all.
all i wanted to do is make a simple https get request using the cpr library, but i have no idea on how to use this at all, so wish someone would help me.
the code might be faulty, that is not the problem here. i just want to know how to use libraries in c++, because i am totally overwhelmed and lost and most of the time dont really understand the documentations.
i’m using ubuntu if this is of any help.
cpr is in directory:
~/cpr
my project is in directory:
~/portfolio/https_request
~/portfolio/https_request/bin
~/portfolio/https_request/include
~/portfolio/https_request/src
in this directory i have folder called bin where i wanted to put my executable into. i have another directory called src where my main.cpp and https_get_request.cpp is in and another directory called include in which is only the header-file https_get_request.h.
main.cpp:
#include <iostream>
#include <string>
#include "../include/https_get_request.h"
int main(int argc, char const *argv[])
{
std::cout << "HTTPS Get Request" << std::endl;
std::string url;
std::cout << "Url: ";
std::cin >> url;
std::cout << std::endl;
httpsGetRequest(url);
return 0;
}
https_get_request.cpp:
#include <string>
#include "cpr/cpr.h"
void httpsGetRequest(std::string url)
{
cpr::Session session;
session.SetUrl(url);
session.SetAcceptEncoding({"disabled"});
cpr::Response response = session.Get();
response.text;
}
i thank everyone who takes his precious time to help a little newbie like me out.
thanks in advance
`
i was expecting to be able to compile the project successfully
user23955037 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.