Home

OFF-SOFT.net

OFF-SOFT.net

This site is support & information site of WEB,and Software. This site might help you that create software or Web Site…perhaps?[:]

(1) Boost library compile with VC++ 2008 Express

Published on| September 8th, 2009 | No Comment.
Discription:
This time, Boost is. Since very famous here, but dared not even explain, continue, and I think it's coverage of the sample source, first, make sure that the configuration described in the article.
Full story, then leave us to another site, here is a brief describes the flow.

(If, Boost a little if you just tried the following URL, you can download the binary. We recommend that there be put to the test. Saves you the trouble of improving the environment intentionally. )

Download

Sample source code you used here:


First, compile
Boost to the directory you downloaded to extract the appropriate set of source code.

The defrosting, Boost, so is the base directory, the directory may be a good easy to understand.

This time, "C: \ Boost" and then to extract that.

Come out in the following descriptions and preferences,% Boost installation directory% is the directory where you installed.

Once the unzipped directory will be created as follows.
1
C:\Boost\Boost1.4.0
※ 1.4.0 is here, BOOST equivalent version.


After the extract, it will compile the following steps.

  1. VC + + 2008 Express to build declare
    C: \ Boost \ Boost1.4.0 \ tools \ build \ v2 \ user-config.jam
    Open to append the following.

    using msvc: 9.0;

  2. Boost root directory (in this case, "C: \ Boost \ Boost1.4.0") to, Boost Jam binary files (bjam.exe) copy (or extract) to

    Binary file is downloaded from the download location of boost-jam-xxx-ntx86.zip above contains a.
    (See here, you can create a binary file from the source code, we will omit the description. )

  3. VC + + 2008 Express in the start-up menu "Visula Studio 2008 Command Prompt" opens a

  4. From a command prompt,% Boost installation directory% \ Boost to move the current directory to the build
    1
    2
    3
    4
    5
    
    C:\Program Files\Microsoft Visual Studio 9.0\VC> cd C:\Boost\Boost1.4.0
    C:\Boost\Boost1.4.0> bjam -toolset=msvc-9.0 --stagedir=C:\Boost\Boost1.4.0\lib ^
                           link=static runtime-link=static,shared threading=multi ^
                           variant=debug,release stage
                           :
    ^ is a continuous one and is meant to be a line.
    This build will be conducted.
    In the example above, we described how to build simple. Other STLPort, ICU, EXPat and if you want to use the Boost libraries and is where you need to specify the parameters.

    Here, let me explain briefly the specified parameters.
    -toolset: make the compiler specified. (msvc-9.0 is, VC + + in 2008 means. )
    - stagedir: the library was ultimately created when you specify a directory name in one directory together. After "stage" with the parameters used.
    link: Boost to specify how to link the library. Here, static, so create a static library.
    runtime: Boost runtime library to use (MSVCRT90.dll) specifies how the link. Here, static, shared, so the static link and DLL creates one of the two links.
    threading: Specify the corresponding thread. Here, multi, so be multithreaded.
    variant: to specify the type to be compiled. Here, debug, release, so the debug version, create each release.
    stage: one summarizes the results compiled into a single directory.


Especially if there is no error and output, OK is.

Prepare a development
To use the Boost, Include and Library path to the path, Boost you need to add the path of each.
(Here, DLL did not create it, DLL is not configured to pass. )

This time, VC + + 2008 Express to use the IDE, so let's go to the Preferences.

  1. Bring up the VC + + 2008 Express
  2. The Tools menu - Options - Projects and Solutions - [VC + + Directories Open.


    Here,
    "Include" a, "C: \ Boost \ Boost1.4.0" Add.
    "Library files" on, "C:\Boost\Boost1.4.0\lib" +"lib" to add.
    This directory is the destination parameter bjam (stagedir) is specified directory.

After the set, OK button.



Let's build a VC + + sample.

Created in VC + + project to create a blank console application.
Paste the following source code to the project to create a cpp file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
 
int main()
{
    using namespace boost::lambda;
    typedef std::istream_iterator<int> in;
 
    std::for_each(
        in(std::cin), in(), std::cout << (_1 * 3) << " " );
 
	return 1;
}

Now, please try to build.
If compilation and linking is completed, OK is.
If you can not compile the above code is incorrect for the environment. Please review the environmental path.

The above program, following adjournment of the console to actually work with the numbers entered into it three times to display the value.

1
2
100
300 

Finally "q" to exit and enter.


This time, the introduction is, Boost is the alphabet of environments.
Boost is so versatile is a library that can be involved in various libraries and each other, many Boost libraries, and I tried to respond to, fine, the hard way.
However, Boost is from a well-known in the various sites, it has been introduced to worry about that point, there would also be helpful to build the environment will be.

Once you would also be a good try.


Comments

Leave a Reply







  • はてなブックマークへ追加する
  • Facebookでシェアする
  • twitter でつぶやく
  • Google Plusでシェアする
  • Pocketでシェアする
ページトップへ