Trouble building Boost Libraries

2020-07-28 11:11发布

问题:

OS: Win7
IDE: Visual Studio 2010 Professional
Boost Lib Version: 1.47

  1. Downloaded "boost_1_47_setup.exe" installer from http://www.boostpro.com/download/
  2. Initially installed everything for VS 10, then just checked every box (5+ GB install!)
  3. Added the "boost\boost_1_47" path into "Additional Include Directories" in C++->General
  4. Copy/Pasted code from "Getting Started on Windows: 4 - Build a Simple Program Using Boost"
  5. Compiled without issue
  6. Included boost/regex.hpp and re-compiled
  7. Received Error:
    LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc100-mt-gd-1_47.lib'
    Expected, haven't built the binaries yet.
  8. Ran "Visual Studio Command Prompt" from tools folder in my VS 10 installation as admin
  9. cd'ed to boost root
  10. Ran bootstrap.bat from command line
  11. Received Error:
    Building Boost.Build engine The system cannot find the path specified. '.\build.bat' is not recognized as an internal or external command, operable program or batch file.

    Failed to build Boost.Build engine. Please consult bootstrap.log for furter diagnostics.

Everything I did came from the Getting Started page on Boost.org. Not sure if its just dated or if I'm doing something wrong.

Came here looking for answers, found some similar issues, namely the following:

Problem with C++ Boost installation (can't find file) in VC++ 2010 Problem with C++ Boost installation (can't find file) in VC++ 2010

Boost C++ Libraries linker error libboost_serialization-vc100-mt-gd-1_47.lib Boost C++ Libraries linker error libboost_serialization-vc100-mt-gd-1_47.lib

No dice. Any help would be appreciated. Thanks

回答1:

The compiler cannot find the BOOST's library file. To fix the issue you have to find on your computer the libboost_regex-vc100-mt-gd-1_47.lib file and add its folder path to the Project->YourProjectName Properties (Alt+F7)->Configuration Properties->Linker->General->Additional Library Directories. After recompile your project.



回答2:

This is the answer to the above comment of @Johnny 5....thousand. In VS10 the compiler-wide additional libraries are deprecated. I solved the problem by adding a new project property sheet to all my projects. It is possible to do it by calling the Property Manager Tab (View->Property Manager). In the Property Manager Tab is necessary to click right mouse button on the project, select Add New Project Property Sheet, Save the sheet to a well-known place. After to define a new User Macro - Name:BOOST, Value: Your Boost Path, for example c:\boost_1_47_0\, also add the $(BOOST) to the Additional Include Directories and ad the $(BOOST)\lib to the Additional Library Directories. That's all. For all other projects is required to add existing property sheet.



标签: boost