Link to boost with visual studio 2013

I am trying to link several enhancement libraries (the ones that need to be compiled) in visual studio 2013 and I am having problems with this.

I installed boost files by running a command from the command line

boostrap.bat 

and

 b2 --toolset=msvc-12.0 --build-type=complete architecture=x86 address-model=64 stage 

so that the libraries are in C: \ boost_1_56_0 / stage / lib

In my project, I go to configuration properties> c / C ++> General> Additional include directories and include C: \ boost_1_56_0 and include headers using for example #include<boost/serialization/vector.hpp> among others

Then I go to configuration properties> linker> additional library dependencies and turn on C: \ boost_1_56_0 \ stage \ lib

Now I know that boost uses automatic binding, so I guarantee that there are no attempts to direct links to boost libraries in the configuration properties> linker> input> additional dependencies

However, I still get (many) linker errors of the following type:

 error LNK2001: unresolved external symbol "public: void __thiscall boost::archive::detail::basic_oarchive::end_preamble(void)" ( ?end_preamble@basic _oarchive@detail @ archive@boost @@QAEXXZ) 

All the relevant questions that I find relate to a misunderstanding of the automatic link setting object, but now I’m directly talking about what I should do (as far as I know). It finds the header files in order, and the library files are where I instruct the linker to look for them.

What can i do wrong?

+5
source share
2 answers

There are many articles for linking enhancement in visual studio when stack overflows. One of them, which I consider to be minimal / complete, How to use Boost in Visual Studio 2010

0
source

I just came across a similar question and shared my idea with you. You are probably building 32-bit and 64-bit libraries for enhancement. So, I think you might have two directories that contain libraries with the same name, but built into different platforms, such as $ (BOOST154_NEW_HOME) \ lib_x64 and $ (BOOST154_NEW_HOME) \ lib_x86. You should have included both paths in your configuration properties> linker> additional library dependencies. Although boost use auto_link to find out which library you want to use, it is still confused about which lib to import under 32 bit or 64 bit.

My suggestion is that you should only include the 64-bit boost libs file in your configuration properties> linker> additional library dependencies.

0
source

Source: https://habr.com/ru/post/1205602/


All Articles