Boost library installation)

Source: Internet
Author: User

1. Download The boost_000035_0 package from the website. Boost old nest
Http://www.boost.org /.

2. Because boost uses its own bjam tool for compilation through command lines, if you open the console window in Windows (click "start" and click "run ", in the C ++ directory of Visual Studio, the Environment vcvarsall. run the bat configuration script once to set the VC compiler environment variables. If you enter the command display window from the tool menu in vs2005 (click the start button, point to "all programs", point to "Microsoft Visual Studio 2005", and point to "Visual Studio Tools ", click "Visual Studio 2005 command prompt"). You do not need to run the environment vcvarsall in the C ++ directory of Visual Studio. bat configuration script.
  
3. decompress the package to the Directory D: \ boost_1_35_0.
  
4. Compile bjam.
Go to the Command Prompt window from the tool menu in vs2005 (click the start button, point to "all programs", point to "Microsoft Visual Studio 2005", and point to "Visual Studio Tools ", click "Visual Studio 2005 command prompt"), CD to D: \ boost_1_35_0 \ tools \ jam \ SRC to execute build. bat, which will be in D: \ boost_1_35_0 \ tools \ jam \ SRC \ bin. create bjam.exeunder ntx86 \ and copy bjam.exe to D: \ boost_1_35_0.
  
5. Set the compiling environment.
Modify msvc configuration for user-config.jam (D: \ boost_1_35_0 \ tools \ build \ V2 \ user-config.jam)
# Msvc Configuration
  
# Configure msvc (default version, searched in Standard Location
# And Path ).
# Using msvc;
Using msvc: 8.0: <compileflags>/wd4819 <compileflags>/logs <compileflags>/d_scl_secure_no_deprecate <compileflags>/d_secure_cl = 0;
  
6. Compile boost
Run the CD directory under D: \ boost_1_35_0 \.
(1) Compile a boost library without ICU support
In this case, the boost library compilation is relatively simple. In the prepared Console window, enter:
Bjam -- without-Python -- toolset = msvc-8.0 -- Build-type = complete -- prefix = "D: \ boost_1_35_0" Stage
You can, if you want to install it, enter:
Bjam -- without-Python -- toolset = msvc-8.0 -- Build-type = complete -- prefix = "D: \ boost_1_35_0" Install

(2) Compile the boost library with ICU support
Download ICU Library: http://site.icu-project.org/home here
First, you must compile the ICU library to compile the boost library. In the prepared Console window, enter:
Bjam-sicu_path = D: \ ICU -- without-Python -- toolset = msvc-8.0 -- Build-type = complete -- prefix = "D: \ boost_1_35_0" Stage
You can, if you want to install it, enter:
Bjam-sicu_path = D: \ ICU -- without-Python -- toolset = msvc-8.0 -- Build-type = complete -- prefix = "D: \ boost_1_35_0" Install
Through the above method, we can normally complete the relationship between various versions required for boost.
Parameter description:
-- Without-Python indicates that python is not used.
-- Toolset: the compiler used, Visual Studio 2005 is the msvc-8.0
-- Build-type: indicates the compilation type. Complete indicates that all versions (such as debug and release) are generated)
-- Prefix: Specifies the directory of the library after compilation.
This step takes a long time (about dozens of minutes, depending on the machine configuration)

7. Set the vs2005 environment.
Tools-> options-> projects and solutions-> VC ++ Directories
Add D: \ boost \ Lib to library files
Add D: \ boost_1_35_0 \ include \ boost-1_35 \ to include files \
Note: The preceding directories are used as examples. You can modify the directories based on your preferences during installation.

Friendly reminder: The downloaded file package is very small, but after compilation, the entire file package is very large (more than 4 GB ). My notebook is a little old, and the hard disk space is not very large, so it was interrupted during installation. Later, I transferred files and took a lot of waste. My friends should leave enough space during compilation!

==== Simple test ====

// Boosttest. cpp: defines the entry point of the console application.
//
# Include "stdafx. H"
# Include <boost/lexical_cast.hpp>
# Include <iostream>

Using namespace STD;
Int _ tmain (INT argc, _ tchar * argv [])
{
Using boost: lexical_cast;

Int A = lexical_cast <int> ("123 ");
Double B = lexical_cast <double> ("123.0123456789 ");
String S0 = lexical_cast <string> ();
String S1 = lexical_cast <string> (B );
Cout <"number:" <A <"" <B <Endl;
Cout <"string:" <S0 <"" <S1 <Endl;
Int C = 0;
Try {
C = lexical_cast <int> ("ABCD ");
}
Catch (boost: bad_lexical_cast & E ){
Cout <E. What () <Endl;
Return 1;
}

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/sptoor/archive/2009/09/23/4580914.aspx

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.