So my current code I am trying to compile:
#include <boost/network/protocol/http/client.hpp>
int main()
{
boost::network::http::client client;
boost::network::http::client::request request("http://www.example.com");
request << boost::network::header("Connection", "close");
boost::network::http::client::response response = client.get(request);
std::cout << body(response);
return 0;
}
All code harvested from [this post] (How can I fetch data from a website inside a C++ program). So I've tried running this thing by itself with a few different scripts provided, but none have worked. Here are some of the scripts I've tried:
g++ -I. -I$BOOST_ROOT -L$BOOST_ROOT/stage/lib -lboost_system
g++ -I. -I/usr/local/include/boost -lboost_thread -lboost_system
-lcppnetlib -client -connections -lcppnetlib -server -parsers
-lcppnetlib -uri -pthread main.cpp
./a.out
I have also tried:
g++ -I. -I$BOOST_ROOT -L$BOOST_ROOT/stage/lib -lboost_system -pthread main.cpp
And also tried:
g++ -I. -I/usr/local/Cellar/boost/1.59.0/include/boost -L/usr/local/Cellar/boost/1.59.0/lib -lboost_system pthread main.cpp
But I noticed after reading some more posts that the -I is used to signify the header files for boost in their root directory and the -L is used to find the libraries for the boost root directory. So I am not sure exactly what I've downloaded because I now have 2 copies and I am not sure if either of them work, and I am tried every combination to try to get this thing running. Apparently I have several copies of boost sitting all over the place. So the /usr/local/Cellar directory holds both up to date ones..
/usr/local/Cellar/boost/1.59.0/include/boost
/usr/local/Cellar/boost/1.59.0/include/lib
Also, the /usr/local/ directory holds both..
/usr/local/include/boost/
/usr/local/lib
And again,
/usr/local/opt/boost/include
/usr/local/opt/boost/include/lib
Does having multiple copies disrupt the process or something? I am so confused.
This is my directory structure:
So my I've tried figuring this out and I am simply stumped.. I am not good with scripting (just recently learned most of it from this issue), and I simply do not know how to compile this thing.. Any help is any way, shape, or form is beyond appreciated. Thanks in advance to anyone who helps.