How to compile and test the boost library under Windows

Source: Internet
Author: User
Tags serialization vc9

A This Works

Http://jingyan.baidu.com/article/00a07f3843a33e82d028dcbf.html


I'm going to take a look at the boost library recently, and here's how to install the boost library. Method/Step

Download:

Download the source code first to boost's official web site.

To compile the VS2008 version of the Boost library:

First, compile the Bjam, run the BOOTSTRAP.BAT-VC9 at the command line, and then compile the library.

Compiling dynamic libraries: Bjam stage--toolset=msvc-9.0--without-graph--without-graph_parallel--without-math-- Without-python--without-serialization--without-wave--stagedir= "D:\Boost\bin\vc9" Link=static runtime-link=shared Threading=multi Debug Release

Compile static library: Bjam stage--toolset=msvc-9.0--without-graph--without-graph_parallel--without-math-- Without-python--without-serialization--without-wave--stagedir= "D:\Boost\bin\vc9" Link=static runtime-link=static Threading=multi Debug Release

The compilation took about 15 minutes, producing around 303MB of files

VS2008 Boost Library configuration:

Tools-> Options-> Projects and Solutions-> VC + + Directories in library files, add D:\Boost\bin\vc9\lib in include Fil ES, add D:\Boost\ where the library's directory is the location of the libraries that were previously compiled, including directories that vary with the different versions of Boost, and now version 1.47 is designated as D:\ Boost is a folder that uses SVN to download boost.

VS2008 Boost Library test:

#include "stdafx.h"

#include <iostream>

#include <boost/date_time/gregorian/gregorian.hpp>

using namespace Std;

using namespace boost;

int _tmain (int argc, _tchar* argv[])

{

cout<< "Please enter your birthday, format \" yyyy-mm-dd\ ":";

String Strbirthday;

cin>>strbirthday;

Try

{

Gregorian::d ate Birthday (gregorian::from_simple_string (strbirthday));

Gregorian::d ate today (Gregorian::d ay_clock::local_day ());

Gregorian::d ays days_alive = today-birthday;

if (Days_alive < gregorian::d ays (0))

{

cout<< "Wow, you can use a computer before you're born." <<endl;

}

Else

{

cout<< "You have appeared in this world:" << days_alive.days () << "Days" << Endl;

}

}

catch (gregorian::bad_year& e)

{

cerr<< e.what () << Endl;

}

catch (gregorian::bad_day_of_month& e)

{

cerr<< e.what () << Endl;

}

catch (gregorian::bad_day_of_year& e)

{

cerr<< e.what () << Endl;

}

catch (...)

{

cerr<< "error!" <<endl;

}

System ("pause");

return 0;

}

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.