0

I am trying to integrate cpp-netlib to my pre-existing boost package and use it in my program.

I am simply including:

#include <boost/network/uri.hpp>

and trying to use it like this:

boost::network::uri::uri u("http://google.com");

While trying to do so I am getting a linker error:

Undefined symbols for architecture x86_64:

  "boost::network::uri::detail::parse(std::__1::__wrap_iter<char const*>, std::__1::__wrap_iter<char const*>, boost::network::uri::detail::uri_parts<std::__1::__wrap_iter<char const*> >&)", referenced from:
      boost::network::uri::uri::parse() in Watcher.o

What I have done so far is to download cpp-netlib, building it using cmake, I believe that was successful since I can see following 3 libraries:

libcppnetlib-client-connections.a
libcppnetlib-server-parsers.a
cppnetlib-uri.a

So my question is where should I place the 3 static libraries which I have generated in order to ensure correct linking. I already can see some library files inside directory:

-Boost
     -bin.v2

Is this the place where I have to keep my libraries to ensure correct linking.

PRIME
  • 1,058
  • 7
  • 21
  • I think you need to tell about these files to linker through some flag(For example /MAPINFO:EXPORTS on windows) – irsis May 04 '15 at 09:22
  • Hi Rahul, I am working on OSX 10.9 What I believe is there should be a place for these libraries in boost directly structure itself, if placed there correctly they should get linked automatically ( Considering the project I am working on is already using boost libraries which requires building and I don't do anything special to use libraries like filesystem which needs to be build ). So I need to know the place in boost root directory where these files are required to place. – PRIME May 04 '15 at 09:27
  • Perhaps Dipak said is correct. You will have to tell linker where the libraries are. – irsis May 04 '15 at 12:15

1 Answers1

0

You should specify a library path for cpp-netlib (-L) and libraries to link (-l):

-lcppnetlib-client-connections.a
-lcppnetlib-server-parsers.a
-lcppnetlib-uri.a 

There is no place to put above libraries in boost folder structure. You have to pass argument when you compile you application.

Dipak D Desai
  • 867
  • 1
  • 8
  • 20