2

I have installed boost and cpp-netlib and successfully ran all tests. I can compile the following example from the command line with the following options:

clang++ -o test main.cpp \
-I/path.../cpp-netlib-0.11.1-final \
-I/path.../boost_1_57_0 \
-L/path.../boost_1_57_0/stage/lib \
-L/usr/local/lib \
-lboost_system \
-lboost_thread \
-lcppnetlib-uri \
-lcppnetlib-client-connections \
-lssl \
-lcrypto \
-pthread

Example from cpp-netlib.org:

#include <boost/network/protocol/http/client.hpp>
#include <iostream>

int main(int argc, char *argv[]) {
    using namespace boost::network;

    if (argc != 2) {
        std::cout << "Usage: " << argv[0] << " [url]" << std::endl;
        return 1;
    }

    http::client client;
    http::client::request request(argv[1]);
    request << header("Connection", "close");
    http::client::response response = client.get(request);
    std::cout << body(response) << std::endl;

    return 0;
}

Running this program:

./test "url"

Successfully displays the html code of website.

I am running into a problem when I try to import this example into Xcode. I have included the correct search paths for header files and binaries. The code will compile but Xcode crashes every time it reaches this line.

http::client::request request(argv[1]);

I can comment out this line and everything after it and the program compiles and runs. Otherwise it crashes, even when trying to use a breakpoint. Any suggestions would be appreciated.

biononic
  • 95
  • 6

1 Answers1

1

This is because of the URI parser generating really big symbols in debug builds. The use of Boost.Spirit in the URI parsing uses very heavy template metaprogramming and that shows up as very long symbols which may not be handled appropriately by the system. I'm not sure whether there are work-arounds here as I don't use the Xcode IDE for regular development of cpp-netlib.

Dean Michael
  • 3,446
  • 1
  • 20
  • 14