Windows 7 32/64bit和Visual Studio 2010下安装及使用Boost
来源:互联网 发布:中国移动网络在线客服 编辑:程序博客网 时间:2024/06/05 09:19
Boost库是一个经过千锤百炼、可移植、提供源代码的C++库,作为标准库的后备,是C++标准化进程的发动机之一。 Boost库由C++标准委员会库工作组成员发起,在C++社区中影响甚大,其成员已近2000人。本文主要介绍了如何安装及使用Boost 1.55.0。
参考网页:http://blog.sina.com.cn/s/blog_6e0693f70100txlg.html
1). 在http://www.boost.org/users/download/下载最新版Boost库。解压后将其复制到指定位置。
2). 打开Visual Studio Command Prompt,进入解压后的Boost目录。输入bootstrap,等待其生成Boost构建工具bjam。
3). 在命令行输入bjam toolset=msvc-10.0 variant=debug,release threading=multi link=static。然后等待安装完成。如果要生成64位库,键入命令bjam toolset=msvc-10.0 variant=debug,release threading=multi link=static address-model=64。
4). 安装完成后,屏幕上会提示"The Boost C++ Libraries were successfully built!"。并制定头文件和库文件目录。
5). 新建一个win32控制台程序,命名为Boost_Test。代码后附。
6). 在Project -> Boost_Test Properties -> Configuration Properties -> C/C++ -> General ->Additional Include Directories 中增加头文件路径。
7). 在Project -> Boost_Test Properties -> Configuration Properties -> Linker -> General -> Additional Library Directories 中增加库文件路径。这里我们不用制定需要链接的静态库,Boost会自动加载需要的库文件。
8). 编译,链接,测试结果如下。
Boost_Test.cpp代码
// Boost_Test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <boost/regex.hpp>
using namespace std;
struct Hello
{
Hello()
{
cout << "Hello constructor" << endl;
}
~Hello()
{
cout << "Hello destructor" << endl;
cin.get();
}
};
int _tmain(int argc, _TCHAR* argv[])
{
boost::regex regex("^(Hello|Bye) Boost$");
boost::cmatch helloMatches;
boost::regex_search("Hello Boost", helloMatches, regex);
cout << "The word between () is: " << helloMatches[1] << endl;
boost::shared_ptr<Hello> sharedHello(new Hello);
cin.get();
return 0;
}
参考网页:http://blog.sina.com.cn/s/blog_6e0693f70100txlg.html
Boost_Test.cpp代码
// Boost_Test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <boost/regex.hpp>
using namespace std;
struct Hello
{
};
int _tmain(int argc, _TCHAR* argv[])
{
}
0 0
- Windows 7 32/64bit和Visual Studio 2010下安装及使用Boost
- Windows 7 64bit和Visual Studio 2010下安装及使用Boost 1.47.0
- Windows 7 64bit和Visual Studio 2010下安装及使用Pthread-w32 2.8
- Windows 7 64bit和Visual Studio 2010下安装及使用Zlib 1.2.5
- Windows 7 64bit和Visual Studio 2010下安装及使用Zlib 1.2.5
- Windows 7 64bit和Visual Studio 2010下安装及使用Zlib
- Windows 7 64bit和Visual Studio 2010下安装及使用OpenCV 2.0
- Windows 7 64bit和Visual Studio 2010下安装及使用Zlib
- 在win7(32bit和64bit) visual studio 2010(vs2010)下安装opencv2.3
- Windows 7 64bit和Visual Studio 2010下的64位与32位程序配置,dll使用,与性能初步比较
- CUDA3.1 X32 + Windows 7 32bit + Visual Studio 2005 + Visual assist安装指南
- 在Windows和Visual Studio上安装Boost
- 在Windows和Visual Studio上安装Boost
- 在Windows和Visual Studio上安装Boost
- win7+visual+studio+2010下安装和配置ace和boost
- Visual Studio 2010 下 Boost.Regex 库的使用笔记
- Visual Studio 2010 下 Boost.Regex 库的使用笔记
- Visual Studio 2010下安装和使用blitz++指南
- extjs中Record、Store、read、MixedCollection大概联系
- 反射总结
- jsp 验证
- 【剑指offer28】字符串的全排列和组合
- JDK源码学习系列01----String
- Windows 7 32/64bit和Visual Studio 2010下安装及使用Boost
- 最近公共祖先LCA Tarjan算法
- 集合框架
- 第五周作业——3.Dijkstra算法的实现
- CSS 学习一
- PHP笔试题
- linux C 语言的 system(执行shell 命令)
- 【Java TCP/IP Socket】TCP Socket(含代码)
- 2014腾讯实习生招聘武汉试题