简体   繁体   中英

Integrating cpp-netlib to pre-existing boost package

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM