Basic ways to use the Boost library under Windows

Source: Internet
Author: User

1, first to the Boost website to download the latest version of the Boost library:

http://www.boost.org/


2. Unzip the file, open it to the root of the boost library at the command prompt, and execute the following command:

Bjam--toolset=msvc--build-type=complete Stage

Waiting for the program to compile, about two hours, will be generated in the boost root directory Bin.v2 and stage two folders, where Bin.v2 is generated intermediate files, the size of about 2.7G, can be directly deleted. The DLL and LIB files are generated under stage.


3. Open vs:

View, property Manager, current project->debug| Win32->microsoft.cpp.win32.user Double-click

In the Properties dialog box that pops up:

Common Properties->vc++ directory: "Include directory": Boost root directory, example: D:\Visual Stdio 2013\lipeng\boost\boost_1_58_0

Library Directory: link library directory under stage, example: D:\Visual Stdio 2013\lipeng\boost\boost_1_58_0\stage\lib

Generic properties, Linker, General: "Additional library directory": Same as above "library directory", example: D:\Visual Stdio 2013\lipeng\boost\boost_1_58_0\stage\lib


At this point the environment is configured, the following test:

#include <cstdlib> #include <iostream> #include <vector> #include <iterator> #include < algorithm> #include <boost/timer.hpp> #include <boost/progress.hpp> #include <libs/date_time/src/ gregorian/greg_names.hpp> #include <libs/date_time/src/gregorian/date_generators.cpp> #include <libs/ Date_time/src/gregorian/greg_month.cpp> #include <libs/date_time/src/gregorian/gregorian_types.cpp>int Main () {Boost::timer t;boost::p rogress_display PD (+), for (int i = 0; i <; ++i) {++pd;} Boost::gregorian::d ate dt (8), Std::cout <<std::endl<< "The Day Is" <<dt.day_of_year () < < "Day of the Year" << std::endl<<std::endl;std::vector<int> TEST_VC (std::vector<int); >::iterator beg_it = Test_vc.begin (); Std::vector<int>::iterator end_it = Test_vc.end (); Std::srand (std::time (NULL)); for (; Beg_it! = End_it; ++beg_it) {*beg_it = rand ();} Beg_it = Test_vc.begin (); Std::copy (Beg_it, END_IT, std::Ostream_iterator<int> (Std::cout, "")); Std::cout << Std::endl << std::endl;std::sort (beg_it, End_it , std::greater<int> ()); Std::copy (Beg_it, End_it, std::ostream_iterator<int> (Std::cout, "")); std::cout << std::endl<<std::endl;std::cout << t.elapsed () << "s" << std::endl;system ("pause"); return 0;}


The program runs correctly:



Author: http://blog.csdn.net/lp310018931

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Basic ways to use the Boost library under Windows

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.