Install boost on Windows and Visual Studio

Source: Internet
Author: User
ArticleDirectory
    • Download and install boost
    • Enable boost in Visual Studio
      Download and install boost

      1. Download a Windows Installer for boost from the boost website.

      Http://www.boost-consulting.com/download/windows

      ThisProgramIt automatically downloads and installs boost.

      The entire boost is as big as 1 GB.

      2. Alternatively, you can download the full boost version on the boost website and install it later.

      Boost_000034_1.exe

      We recommend that you use the first download method. Because the download speed of the program is very fast. I chose to download from Japan.

 

  •  

    •  

        Now, you can write our first boost program.

        # Include "stdafx. H"

        # Include <iostream>

        # Include <cassert>

        # Include <string>

        # Include "Boost/RegEx. HPP"

        Int main (){

        // 3 digits, a word, any character, 2 digits or "N/",

        // A space, then the first word again

        Boost: RegEx Reg ("d ([A-Za-Z] +). (d | n/a) s ");

        STD: String correct = "123 Hello N/A hello ";

        STD: String incorrect = "123 Hello 12 hello ";

        Assert (boost: regex_match (correct, Reg) = true );

        Assert (boost: regex_match (incorrect, Reg) = false );

        }

        The "additional library directory" contains the boost lib library directory folder.

    • For my configuration, enter D: C ++ runtimoostoost_000034_1lib.

  • Enable boost in Visual Studio

    Add the boost directory to the project properties.

    The boost installation directory I selected is as follows:

    D: C ++ runtimoostoost_000034_1

    1. Add the include to the boost header file directory in "add include directory. To include the boost header file correctly.

    For my configuration, enter D: C ++ runtimoostoost_000034_1.

    This directory contains the header file bind. HPP.

    2. You also need to append the boost lib and DLL files.

    • From: http://www.stor-age.com/techupdate/2008/0301/748247.shtml

      ========================================================== ========

      After the above installation is complete, the compilation example is shown as follows:

      File libboost_regex-vc90-mt-gd-1_44.lib cannot be opened"

      I found a solution on the internet, used the release version to compile it correctly, or compiled the Lib file according to the original boost source code, and then added it;

      For example, to test whether boost is successfully installed, you can use another column:

       

      # Include <iostream> # include <iomanip> # include "Boost/format. HPP "int main () {using namespace STD; using boost: format; using boost: IO: group; // combine // simple style of reordering: cout <format ("% 1% d adsdf % 2% % 3% % 2% % 1% \ n") % "O" % "oo" % "O "; // prints "O oo o \ n" // optional // centered alignment: flag' = 'cout <format ("_ % | = 6 | _") % 1 <Endl; // prints "_ 1 _": 3 spaces are padded before, and 2 after. vector <string> names (1, "Marc-Fran is Michel"), surname (1, "Durand"), Tel (1, "+ 33 (0) 123 456 789 "); names. push_back ("Jean"); surname. push_back ("De Lattre de Tassigny"); tel. push_back ("+ 33 (0) 987 654 321"); For (unsigned int I = 0; I <names. size (); ++ I) cout <format ("% 1%, % 2%, % | 40t | % 3% \ n ") % Names [I] % surname [I] % Tel [I]; cerr <"\ n \ neverything went OK, exiting. \ n "; getchar (); Return 0 ;}

       

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.