I'm using VC8.0 and Boost_1_35_0. It's okay to recompile boost yourself, but I use the
Http://www.boostpro.com/products/free
The installation tool provided Boostpro 1.35.0 Installer (192K. exe). I strongly recommend using this tool to install the Boost library and source files under Windows.
1 Use the Boost_1_35_0_setup.exe tool to download the Boost library, select the package you want (the type is always mutilthread and Mutithread Debug), automatically installed after downloading. I use VC8.0 boost_1_35_0 to install in E:\boost. I mainly introduce the 2 libraries that need to be compiled before using regex and signals.
2 I set up a console project under the VC8.0, and added a VC inclusion directory for the project: E:\BOOST\BOOST_1_35_0, and Library directory: E:\boost\boost_1_35_0\lib. You do not need to specify which library to link to because the system will automatically find it.
3 Note that I do not use the dynamic link library, because a bunch of warnings, let me fear. So I use a static connection library, which is a library with a libboost-xxx style before the name. For example, to use (note the exact same name as the following):
Debug under:
Libboost_signals-vc80-mt-gd-1_35.lib
Libboost_regex-vc80-mt-gd-1_35.lib
Release under:
Libboost_signals-vc80-mt-1_35.lib
Libboost_regex-vc80-mt-1_35.lib
And the project properties of VC are:
Debug: Multithreaded Debug DLL (/MDD), not Unicode
Release: Multithreaded DLL (/MD), not Unicode
In particular, be aware that when using a tool to download, always download:
Mutilthread and Mutithread Debug
The advantage of this is that we are linked to the static boost library, so no boost DLL is needed. Don't choose to use Boost's dynamic library in order to covet the small size of the Run-time package, at least I shudder at the warning.
Here is a small example, no warning, everything is on schedule:
///////////////////////////////////////////////////////////////////////////////
Main.cpp
//
Using the Boost C + + standard library
//
//
2008-7-10 Cheungmine
//
///////////////////////////////////////////////////////////////////////////////
#include <boost/lambda/lambda.hpp>
#include <boost/regex.hpp>
#include <iostream>
#include <cassert>
#include <boost/signals.hpp>
struct Print_sum {
void operator () (int x, int y) const {std::cout << x+y << Std::endl;}
};
struct Print_product {
void operator () (int x, int y) const {std::cout << x*y << Std::endl;}
};
//
Main program
//
int main (int argc, char** argv)
{
boost::signal2<void, int, int, boost::last_value<void>, std::string> Sig;
Sig.connect (Print_sum ());
Sig.connect (Print_product ());
SIG (3, 5);
Std::string Line;
Boost::regex Pat ("^subject: (Re: | Aw:) * (. *) ");
while (std::cin)
{
Std::getline (std::cin, line);
Boost::smatch matches;
if (Boost::regex_match (line, matches, Pat))
Std::cout << matches[2] << Std::endl;
}
return 0;
}