Install boost under WINDOWS

Source: Internet
Author: User

The boost library is a portable, source-code C + + library that is backed up as a standard library and is one of the development engines of the C + + standardization process. The boost library is sponsored by the C + + Standards Committee Library team, and some of them are expected to become the next generation C + + standard library content. In the C + + community is very influential, is the absolute "quasi" standard library. Boost due to its emphasis on cross-platform, the emphasis on standard C + + is independent of the authoring platform. Most of the boost library features need to include only the corresponding header files, and a few (such as regular expression libraries, file system libraries, etc.) require a link library. But there are a lot of things that are experimental in boost, and they need to be cautious in practical development.

Method/Step
  1. 1

    Current boost latest version is 1.55,:

    http://sourceforge.net/projects/boost/files/boost/1.55.0/

    or download the latest version of Boost source from the official website (www.boost.org).

    After testing, the steps 2012 and 2013 are the same, with 2012 as an example.

  2. 2

    1. Open VS2012 Native Tools Command, which you can find from the beginning--microsoft Visual Studio 2012:

  3. 3

    Unzip the downloaded boost_1_55_0.zip on the F-drive, e.g. F:\BOOST_1_53_0

    Execute Bootstrap.bat, as shown in the Green box:

  4. 4

    Compile, you can simply use the B2 install, you can also specify a directory, or find other online help articles.

    View Help can be entered as:. \B2--help

    For example, to turn on multithreaded compilation: B2 Install Threading=multi

    The settings are generated by debug or release

    Note: If you are using VS2013, specify the output library type, or you will be missing a Lib file:

    "Unable to open file Libboost_thread_vc120_mt_sgd-1_55.lib".

    At 2013, I was compiling with the following statement:

    If you want to get a dynamic library:

    Bjam Install stage--toolset=msvc-12.0--stagedir= "C:\Boost\boost_vc_120" link=shared runtime-link=shared threading= Multi Debug release

    If you are getting a static library:

    Bjam Install stage--toolset=msvc-12.0--stagedir= "C:\Boost\boost_vc_120" link=static runtime-link=static threading= Multi Debug release

    Note that change--toolset=msvc-12.0, change 12.0 to the corresponding VS version number, 12.0 is the VS2013 version number.

    The destination address should also be changed to what you need.

    Note, do not miss the install, it will help you to set the head file into a folder.

    The compilation process has a copy process, the compilation takes a long time, this compilation process, the C packing directory will generate a boost folder, and then include the Include and Lib folders, which is the header and library files we will use.

  5. 5

    After compiling, we will use the files compiled in the C drive. I copied them to the F drive,

    Three files are: 1) The Boost header files and library files that will be used.   2) Extract the Boost folder, is to use this folder for 1-3 steps. 3) Boosttest test project.

    Requires a simple configuration of two places:

    The absolute path is used here, and the environment can be configured to use it.

  6. 6

    Then an engineering test was established. To create a new console application in Boosttest, three files are:

    1) The Boost header files and library files that will be used.   2) Extract the Boost folder, is to use this folder for 1-3 steps. 3) Boosttest test project.

    #include <iostream>

    #include <boost/thread/thread.hpp>

    void Hello ()

    {

    Std::cout << "Hello World, I ' m a thread!" << Std::endl;

    }

    int main ()

    {

    Boost::thread thrd (&hello);

    Thrd.join ();

    }

    Compile the test project and run it and start the boost journey.

    END

Install boost under WINDOWS

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.