Integrating Boost into Visual Studio 2010
Introduction
Boost is a comprehensive collection of C libraries that enhance the capabilities of the standard C library. To seamlessly integrate Boost into an empty project in Visual Studio 2010, follow these step-by-step instructions.
Headers-Only Integration
- Extract the Boost archive into a designated directory.
- In your empty Visual Studio 2010 project, navigate to the Property Manager and select a platform configuration.
- Right-click "Microsoft.Cpp..user" and select "Properties."
- In the VC Directories tab, add the path to the Boost source files under "Include Directories."
- Repeat steps 3-4 for other target platforms as needed.
Integration with Built Components
- Extract the Boost archive into a designated directory.
- Launch the Visual Studio Command Prompt and navigate to the Boost directory.
- Execute "bootstrap.bat" to build b2.exe, a component that automates library building.
-
Run the "b2" command with appropriate arguments:
- For Win32: b2 --toolset=msvc-10.0 --build-type=complete stage ;
- For x64: b2 --toolset=msvc-10.0 --build-type=complete architecture=x86 address-model=64 stage ;
- Add the path to the Boost libraries output to "Library Directories" in the Property Manager, following steps 3-5 from the previous section.
Integration with Optional Components
Boost.IOStreams Bzip2 Filters:
- Extract the Bzip2 library source files into a designated directory.
- Re-run the "b2" command with the additional argument: -sBZIP2_SOURCE="C:bzip2-1.0.6"
Boost.IOStreams Zlib Filters:
- Extract the Zlib library source files into a designated directory.
- Re-run the "b2" command with the additional argument: -sZLIB_SOURCE="C:zlib-1.2.5"
Boost.MPI:
- Install an MPI distribution such as Microsoft Compute Cluster Pack.
- Edit the "project-config.jam" file in the Boost directory and add the line: using mpi ;
- Re-run the "b2" command if necessary.
Boost.Python:
- Install a Python distribution and add it to your PATH.
- Edit the "project-config.jam" file and add lines specifying the Python installation paths and versions.
- Re-run the "b2" command.
Boost.Regex ICU Support:
- Extract the ICU4C library source files into a designated directory.
- Build all solutions in the "sourceallinone" directory for both debug and release configurations.
- Re-run the "b2" command with the additional argument: -sICU_PATH="C:icu4c-4_8"
The above is the detailed content of How to Integrate Boost Libraries into Visual Studio 2010?. For more information, please follow other related articles on the PHP Chinese website!