I've just rebuilt boost 1.57 on Windows using MSVC because I want to add support for zlib:
.\b2 toolset=msvc-12.0 link=shared threading=multi address-model=64 --build-type=complete install -s NO_ZLIB=0 -s ZLIB_SOURCE=D:\zlib128
This builds fine and generates new files boost_zlib-vc120-mt-1_57.dll
and boost_zlib-vc120-mt-1_57.lib
.
I'm then using cmake to add boost to my project:
FIND_PACKAGE(Boost ${BOOST_VERSION} EXACT REQUIRED COMPONENTS system date_time filesystem iostreams regex thread zlib)
if(Boost_FOUND)
ADD_DEFINITIONS(${BOOST_DEFINITIONS} -DBOOST_ALL_NO_LIB)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
TARGET_LINK_LIBRARIES(foobar ${Boost_LIBRARIES})
endif()
In Visual Studio, I see in "Additional Dependencies" that the boost_zlib-vc120-mt-1_57.lib
is now also listed there. But trying to compile this example fails with a linker error:
Error 1730 error LNK2019: unresolved external symbol "int const boost::iostreams::zlib::default_compression" (?default_compression@zlib@iostreams@boost@@3HB) referenced in function "public: __cdecl boost::iostreams::detail::zlib_decompressor_impl >::zlib_decompressor_impl >(int)" (??0?$zlib_decompressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QEAA@H@Z)
How can I fix this?