cpp-netlib/cpp-netlib — Issue #88: Linking problem on Fedora
Author: Jiboo
Created: 2012-02-01 12:46:45+00:00
State: open

Hello,

I'm trying to build this library on Fedora 16.
GCC 4.6.2, boost 1.49 rev (76818), cpp-libnet from git

I first ran into problems while compiling the library. I used "cmake . && make":

https://gist.github.com/ae57cc781363cd253fab

I was able to compile by doing this little modification:

```cpp
diff --git a/boost/network/protocol/http/client/macros.hpp b/boost/network/protocol/http/client/macros.hpp
index 92c9f5e..f4fad80 100644
--- a/boost/network/protocol/http/client/macros.hpp
+++ b/boost/network/protocol/http/client/macros.hpp
@@ -11,7 +11,7 @@

#ifndef BOOST_NETWORK_HTTP_BODY_CALLBACK
#define BOOST_NETWORK_HTTP_BODY_CALLBACK(function_name, range_name, error_name) \
- void function_name (boost::iterator_range const & range_name, boost::system::error_code const & error_name)
+ void function_name (boost::iterator_range const & range_name, boost::system::error_code const & error_name)
#endif

#endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_MACROS_HPP_20110430 */
```

I installed the library using:

sudo cp boost/* /usr/locale/include/boost/
sudo cp libs/network/src/*.a /usr/locale/lib/

And tried to compile this little program:

```cpp
#include

using namespace boost::network;
using namespace boost::network::http;

BOOST_NETWORK_HTTP_BODY_CALLBACK(print_body, range, error) {
if (!error)
std::cout << "Received " << boost::distance(range) << "bytes."
<< std::endl;
else
std::cout << "Error: " << error << std::endl;
}

int main(int,char**)
{
client client;
client::request request("http://www.boost.org/");
request << header("Connection", "close");
client::response response = client.get(request, _body_handler=print_body);

return 0;
}
```

With this command line :

g++ -std=c++0x -lcppnetlib-uri-parsers -lcppnetlib-server-parsers -lboost_system -lboost_thread -lpthread http_client.cpp

But I got this linking problem:

/tmp/ccRHKpO7.o: In function `boost::network::uri::basic_uri::parse()':
http_client.cpp:(.text._ZN5boost7network3uri9basic_uriINS0_4http4tags27http_async_8bit_udp_resolveEE5parseEv[boost::network::uri::basic_uri::parse()]+0x69): undefined reference to `boost::network::uri::detail::parse(__gnu_cxx::__normal_iterator, std::allocator > >, __gnu_cxx::__normal_iterator, std::allocator > >, boost::network::uri::detail::uri_parts, std::allocator > >&)'

But i'm linking with the parsers on the command line options, any ideas for solving this problem?

Thanks,
Jiboo.