I am trying to build the cpp-netlib library from Visual Studio 2010 but get the following linker error:
error LNK2019: unresolved external symbol “bool __cdecl
boost::network::uri::detail::parse_uri_impl(class
boost::iterator_range,class std::allocator > > &,struct
boost::network::uri::detail::uri_parts_default_base &,struct
boost::network::tags::default_string)”
(?parse_uri_impl@detail@uri@network@boost@@YA_NAAV?$iterator_range@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@4@AAUuri_parts_default_base@1234@Udefault_string@tags@34@@Z)
referenced in function “bool __cdecl
boost::network::uri::detail::parse_uri,class
std::allocator >,struct
boost::network::http::tags::http_default_8bit_tcp_resolve>(class
std::basic_string,class
std::allocator > &,struct
boost::network::uri::detail::uri_parts &)”
(??$parse_uri@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@Uhttp_default_8bit_tcp_resolve@tags@http@network@boost@@@detail@uri@network@boost@@YA_NAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAU?$uri_parts@Uhttp_default_8bit_tcp_resolve@tags@http@network@boost@@@0123@@Z)
A little bit of digging turned up that this could be related to the version of Boost I’m using (1.46.1) but I have tried compiling against both 1.47.0 and 1.45.0 and get the same error.
What is required to get this library to compile?
After a lot of searching I found this post and this one from the creator of the library, mentioning:
I am able to compile if I add that macro definition before my cpp-netlib headers like so:
In the second post I found there is also mention of “You need to build/link against the uri library” which sounds like it might be a better solution.
Unfortunately my knowledge of c++ and boost isn’t the best so I just went with what worked.
Any better approaches are welcome, though all I really wanted to do was compile the library so I can evaluate it for real use, so I’m happy right now.