Install and use boost library under VS2010

Source: Internet
Author: User

Boost official website http://www.boost.org/

Boost SourceForge http://sourceforge.net/projects/boost/files/

ASIO official website http://think-async.com/

ASIO sourceforge http://sourceforge.net/projects/asio/files/

ASIO samples Https://github.com/mabrarov/asio_samples

1. Go to the official website www.boost.org Download the latest boost, I downloaded Boost_1_55_0.zip and Boost_1_55_0-msvc-10.0-32.exe. The former is the pure source code, needs the user compiles, the latter is VS2010 compiled, contains the source code and compiles builds the library.

2. Here we only speak v. Boost_1_55_0-msvc-10.0-32.exe. The installation path is not recommended for C-disk, such as D:\tmpcode\boost_1_55_0. 3.4GB Hard drive space is required for installation.

3. Set Windows environment variables. The use of tools rapid environment Editor is recommended. http://www.rapidee.com/

environment variable, user variable group, new variable name: BOOST, variable value: D:\tmpcode\boost_1_55_0

4. Modify VS2010 parameters, find the property page in the project solution, open and select the configuration properties, select the VC + + directory, set the Include directory and library directory, such as my:

Contains catalog $ (BOOST); $ (Includepath)

Library catalog $ (BOOST) \lib32-msvc-10.0;$ (LibraryPath)

5. This setting is complete. If you want to compile your own source Boost_1_55_0.zip, please refer to the article:

http://blog.csdn.net/misskissc/article/details/9793645

6. Run the following program to test

#include "stdafx.h"
#include <boost/config.hpp>
#include <iostream>
#include <vector>
#include <string>
#include <boost/graph/adjacency_list.hpp>
#include <boost/tuple/tuple.hpp>
Enum family
{Jeanie, Debbie, Rick, John, Amanda, Margaret, Benjamin, N};
int main ()
{
using namespace boost;
const char *name[] = {"Jeanie", "Debbie", "Rick", "John", "Amanda",
"Margaret", "Benjamin"
};
Adjacency_list <> g (N);
Add_edge (Jeanie, Debbie, G);
Add_edge (Jeanie, Rick, G);
Add_edge (Jeanie, John, G);
Add_edge (Debbie, Amanda, G);
Add_edge (Rick, Margaret, G);
Add_edge (John, Benjamin, G);
Graph_traits < adjacency_list <> >::vertex_iterator I, end;
Graph_traits < adjacency_list <> >::adjacency_iterator AI, a_end;
Property_map < Adjacency_list <>, vertex_index_t >::type
Index_map = Get (Vertex_index, g);
For (Boost::tie (i, end) = vertices (g); I!= end; ++i) {
Std::cout << name[get (Index_map, *i)];
Boost::tie (AI, a_end) = Adjacent_vertices (*i, G);
if (ai = = a_end)
Std::cout << "has no children";
Else
Std::cout << "is the parent of";
for (; Ai!= a_end; ++ai) {
Std::cout << name[get (Index_map, *ai)];
if (Boost::next (AI)!= a_end)
Std::cout << ",";
}
Std::cout << Std::endl;
}
return exit_success;
}


Recommended Sister Chapter "Linux system compiled boost source code, then and QT creator supporting use"

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.