Use vs2015 to compile a 64-bit boost Library

Source: Internet
Author: User
Tags visual studio 2010

Compilation references written by others:

Objective: To use vs2015 to compile a 64-bit boost library.

We have been building and using boost in the Win32 environment for a long time, but now we basically work in 64-bit win7 every day, so it is necessary to sum up the experience of these days.

1. Download and decompress the boost 1.61.0 package

2. decompress and run the batch processing file Bootstrap. bat. Two executable files are generated under the directory.

3. unlike the 32-bit environment, compiling in the x64 environment must start vs2015 x64 native tools command prompt of Visual Studio from the Start menu to enter the command prompt, instead of opening any command line window.

4. Then, run bootstrap.batto generate the b2.exe and bjam.exe versions of x64. (they are only products of different versions, but their usage is the same. bjam is of the previous version and B2 is the latest version)

5. Run the following command:

B2 -- Build-type = complete toolset = msvc-14.0 threading = multi link = shared address-model = 64

You can generate the DLL platform library. If you want to compile the static library version, Change shared to static.

  • If only one library is generated, add the -- with-Python compilation option to avoid generating too much data and taking too long.
  • The address-model = 64 attribute is required. If this attribute is not available, a 32-bit platform library is generated by default. You can add this option to generate a 64-bit DLL.
  • To generate a boost. Python library, you must first download and install the python installation package for x64. the version I use is 3.2.3. When using this library to compile Python extension DLL, the dynamic library version of boost is used by default. python, to use the static version, you must define the boost_python_static_lib macro in the C ++ project so that you don't have to bring the boost_python-vc90-mt-1_50.dll together when using or releasing the extension, of course, the size of the dll extension will be larger. If this is not necessary in the experiment, the files generated slowly will also be larger.

 

 

My process is as follows:

1.Download 1.63.0BoostLibrary, place D: \ boost_201763_0

 

 

2.Compile 64Bit boostYou needProvides a command prompt for operations.

 

 

 

 

 

 

3.Start to switch to boostRun Bootstrap. bat in the root directory.Generate x64Your bjam.exeAnd B2.

 

 

 

4.

B2Is the new version, and then run the command: 64Bit static library

B2 stage -- toolset = msvc-14.0 -- without-graph -- without-graph_parallel -- stagedir = "D: \ boost_000063_0 \ lib64-msvc-14 "address-model = 64 link = static runtime-link = static threading = multi debug release

 

64Bit dynamic library

B2 stage -- toolset = msvc-14.0 -- without-graph -- without-graph_parallel -- stagedir = "D: \ boost_000063_0 \ lib64-msvc-14 "address-model = 64 link = static runtime-link = shared threading = multi debug release

 

I use:

B2 stage -- toolset = msvc-14.0 -- without-graph -- without-graph_parallel -- stagedir = "D: \ boost_1_63_0 \ lib64-msvc-14" address-model = 64 link = shared threading = multi

 

B2 stage -- toolset = msvc-14.0 -- without-graph -- without-graph_parallel -- stagedir = "D: \ boost_1_63_0 \ lib64-msvc-14" address-model = 64 link = static threading = multi

5.Note thatAddress-model = 64Property. If this property is not available, it is generated by default.32To generate64BitDLL.

 

 

 

 

It takes a long time to compile

 

 

Then you can use it.

6. Usage:

Set the environment variables. The header file path is boost64_base_dir and boost64_lib_dir.

 

 

 

 

 

 

2017/8/28

Compile the system again and compile the boost library in Visual Studio 2010:

Use the 64-bit vs2010 tool, switch to the boost directory, and type the command:

B2 stage -- toolset = msvc-10.0 -- stagedir = "D: \ boost_000063_0 \ lib64-msvc-10" address-model = 64

 

Select the full compilation, the compilation path of well-known databases, and the compiler tool. Although it takes a long time, there will be no missing library prompts.

Use vs2015 to compile a 64-bit boost Library

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.