简体   繁体   中英

Visual Studio 2010 linker error when using boost::thread

I am trying to using the C++ Boost threading library in Visual Studio 2010 but get a linker error when including the thread library that requires the boost libs .

Here is the linker error after including <boost/thread/thread.hpp>

Error 2 error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)

After some research I got the impression that this error can be caused by a bad installation or installation of the wrong build version so here is the installation steps I took.

  1. Downloaded boost_1_51_setup.exe from http://www.boostpro.com/download/

  2. Ran the installer selecting all the tick boxes on the threading and library page

  3. Allowed the installer to add an environment variable to the OS path

  4. In the visual studio project added C:\\Program Files\\boost\\boost_1_51 to additional dependencies in C/C++-> General

  5. Finally added C:\\Program Files\\boost\\boost_1_51\\lib to additional libraries in Linker->General

I have triple checked all the path, all seem fine. And read the boost getting started page several time... I can't find what I'm missing.

I am running windows 8 x64, although I don't think this makes a difference.

Right click your project in the solution explorer and click properties.

Go to the VC++ directories tab and add the boost libraries do the 'Library Directories'.

You could also add the include folders to the 'Include Directories' section.

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