• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            兔子的技術(shù)博客

            兔子

               :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
              202 Posts :: 0 Stories :: 43 Comments :: 0 Trackbacks

            留言簿(10)

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            在vs2010下編譯boost

            注意紅色大字體


            boost最新版本1.44已經(jīng)支持vs2010,然而直接下載編譯會(huì)發(fā)現(xiàn)一堆bug;

            首先由bootstrap編譯bjam的時(shí)候就會(huì)碰釘子,典型的錯(cuò)誤就是:

            Failed to build Boost.Jam build engine.
            Please consult bjam.log for furter diagnostics.

            查看bjam.log后可以發(fā)現(xiàn)里面的錯(cuò)誤信息:

            command.c : fatal error C1033: cannot open program database ''

            Technorati 標(biāo)簽: ,,,

            這個(gè)問題在于一個(gè)vs編譯環(huán)境。默認(rèn)我們都直接進(jìn)入cmd進(jìn)行編譯,在vs2010環(huán)境下這個(gè)是行不通的。

            其次的錯(cuò)誤就是通過bjam編譯boost庫(kù)的時(shí)候,會(huì)發(fā)現(xiàn)編譯過程中出現(xiàn)很多fatal,很多庫(kù)編譯不成功;

            解決辦法: 在開始菜單中,Microsoft Visual Studio 2010\Visual Studio Tools下運(yùn)行Visual Studio Command Prompt (2010),通過這個(gè)cmd進(jìn)入boost的目錄進(jìn)行bjam的編譯以及運(yùn)行bjam編譯boost;

            搞定bjam后,在Visual Studio Command Prompt (2010)下直接運(yùn)行:

            bjam --toolset=msvc-10.0 --with-date_time --with-program_options --with-system --with-thread --with-filesystem --with-test --with-regex --with-crypto --with-serialization

            然后就可以去喝咖啡了

            具體編譯參數(shù)詳見:http://sswflying.spaces.live.com/blog/cns!A1AF9E41EDCAEF99!515.entry

            boost庫(kù)編譯方法(zz)

            Windows下:

            C++代碼

            1. bjam.exe --build-type=minimal --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread toolset=msvc-9.0 variant=release link=static threading=multi stage 
            bjam.exe --build-type=minimal --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread toolset=msvc-9.0 variant=release link=static threading=multi stage
            

            Linux下:

            C++代碼

            1. ./bjam --build-type=minimal --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread variant=release link=static threading=multi stage 
                ./bjam --build-type=minimal --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread variant=release link=static threading=multi stage
            


            :-)
            ////////////////////////////////////////////////
            許多新人對(duì)于編譯BOOST感到無從下手,甚至因此而放棄使用BOOST,那真的太可惜了,下面我把一些常用的BOOST編譯方法貼于此,同時(shí)也作為自己的筆記。
            首先下載bjam.exe,復(fù)制到 $BOOST$ 目錄下。或者自己生成bjam,打開Visual Studio 2008 命令提示窗口$BOOST$\tools\jam\src,執(zhí)行 build.bat 會(huì)在$BOOST$\tools\jam\src\bin.ntx86 生成 bjam.exe 文件。復(fù)制文件 bjam.exe  文件到 $BOOST$\下
            1.完全編譯安裝:
            bjam --toolset=msvc install
            完成后會(huì)生成一個(gè)bin.v2編譯時(shí)的臨時(shí)目錄,手動(dòng)刪除。生成另一個(gè)目錄C:\boost,里面為所有的頭文件和庫(kù)文件。頭文件目錄為boost_1_34_1\boost目錄復(fù)制過去的。
            2.只編譯相應(yīng)的庫(kù)文件
            bjam --toolset=msvc stage
            完成后同樣會(huì)生成bin.v2臨時(shí)目錄。另一個(gè)目錄為stage文件,里面有對(duì)應(yīng)的庫(kù)文件。
            3.查看需要編譯才能使用的庫(kù)列表
            bjam --show-libraries
            4.編譯特定的庫(kù),如只編譯regex
            bjam --toolset=msvc --with-regex stage
            生成的庫(kù)文件在stage目錄中。
            5.不編譯某個(gè)庫(kù),如不編譯regex
            bjam --toolset=msvc --without-regex stage
            生成的庫(kù)文件在stage目錄中。
            6.編譯特定的庫(kù),如只編譯regex,生成debug,多線程,共享連接版本,并保存在stage。
            bjam --toolset=msvc --with-regex stage debug threading=multi link=shared
            7.生成 mt-sgd 的靜態(tài)庫(kù)(runtime-link-static)
            bjam "-sTOOLS=vc-8_0" --with-thread install debug release runtime-link=static
            8.編譯regex庫(kù)。
            bjam --toolset=msvc --with-regex stage debug release threading=multi threading=single link=shared link=static runtime-link=shared runtime-link=static
            boost的安裝方法:
            對(duì)于DLL版本
            bjam --toolset=msvc link=shared runtime-link=shared threading=multi stage debug release install
            對(duì)于lib版本
            bjam --toolset=msvc link=static runtime-link=shared threading=multi stage debug release install
            另外,在$BOOST$\tools\build\v2\user-config.jam找到下面的地文
            # -------------------
            # MSVC configuration.
            # -------------------
            # Configure msvc (default version, searched for in standard locations and PATH).
            # using msvc ;
            # Configure specific msvc version (searched for in standard locations and PATH).
            # using msvc : 8.0 ;
            #在這里添加 vs2008 的配置
            using msvc : 9.0 : : /wd4819 /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE  /D_SECURE_SCL=0 ;
            #在這里添加 vs2005 的配置
            using msvc : 8.0 : : <compileflags>/wd4819 <compileflags>/D_CRT_SECURE_NO_DEPRECATE <compileflags>/D_SCL_SECURE_NO_DEPRECATE <compileflags>/D_SECURE_SCL=0 ;   
            然后進(jìn)入 $BOOST$ 目錄,執(zhí)行bjam.exe 編譯命令
            //下面的命令的各選項(xiàng)的說明:
            //prefix    將boost安裝到的路徑(生成的頭文件和庫(kù)文件都會(huì)放到該路徑中)。
            //重定義以下變量(利用-s設(shè)置):
            //VC80_ROOT   vc2005的安裝路徑,如果未將vc2005安裝到默認(rèn)位置,你必須指定該項(xiàng)。
            //TOOLS         使用的編譯工具,vc2005對(duì)應(yīng)的是vc-8_0
            //PYTHON_ROOT   ython的安裝目錄,如果未將BOOST安裝到默認(rèn)位置,你必須指定該項(xiàng)。
            //BUILD         編譯結(jié)果選項(xiàng),默認(rèn)會(huì)生成盡可能多的版本,如調(diào)試版/發(fā)行版,靜態(tài)庫(kù)/動(dòng)態(tài)庫(kù),單線程/多線程。
            bjam 命令說明
            Boost.Build V2 (Milestone 12)
            Boost.Jam 03.1.16
            Project-specific help:
              Project has jamfile at Jamroot
            Usage:
              bjam [options] [properties] [install|stage]
              Builds and installs Boost.
            Targets and Related Options:
              install                 Install headers and compiled library files to the
              =======                 configured locations (below).
              --prefix=<PREFIX>       Install architecture independent files here.
                                      Default; C:\Boost on Win32
                                      Default; /usr/local on Unix. Linux, etc.
              --exec-prefix=<EPREFIX> Install architecture dependent files here.
                                      Default; <PREFIX>
              --libdir=<DIR>          Install library files here.
                                      Default; <EPREFIX>/lib
              --includedir=<HDRDIR>   Install header files here.
                                      Default; <PREFIX>/include
              stage                   Build and install only compiled library files
              =====                   to the stage directory.
              --stagedir=<STAGEDIR>   Install library files here
                                      Default; ./stage
            Other Options:
              --build-type=<type>     Build the specified pre-defined set of variations
                                      of the libraries. Note, that which variants get
                                      built depends on what each library supports.
                                          minimal (default) - Builds the single
                                          "release" version of the libraries. This
                                          release corresponds to specifying:
                                          "release <threading>multi <link>shared
                                          <link>static <runtime-link>shared" as the
            Boost.Build variant to build.
                                          complete - Attempts to build all possible
                                          variations.
              --build-dir=DIR         Build in this location instead of building
                                      within the distribution tree. Recommended!
              --show-libraries        Displays the list of Boost libraries that require
                                      build and installation steps, then exit.
              --layout=<layout>       Determines whether to choose library names
                                      and header locations such that multiple
                                      versions of Boost or multiple compilers can
                                      be used on the same system.
                                          versioned (default) - Names of boost
                                          binaries include the Boost version
                                          number and the name and version of the
                                          compiler.  Boost headers are installed
                                          in a subdirectory of <HDRDIR> whose
                                          name contains the Boost version
                                          number.
                                          system - Binaries names do not include
                                          the Boost version number or the name
                                          and version number of the compiler.
            Boost headers are installed directly
                                          into <HDRDIR>.  This option is
                                          intended for system integrators who
                                          are building distribution packages.
              --buildid=ID            Adds the specified ID to the name of built
                                      libraries.  The default is to not add anything.
              --help                  This message.
              --with-<library>        Build and install the specified <library>
                                      If this option is used, only libraries
                                      specified using this option will be built.
              --without-<library>     Do not build, stage, or install the specified
                                      <library>. By default, all libraries are built.
            Properties:
              toolset=toolset         Indicates the toolset to build with.
              variant=debug|release   Select the build variant
              link=static|shared      Whether to build static or shared libraries
              threading=single|multi  Whether to build single or multithreaded binaries
              runtime-link=static|shared    
                                      Whether to link to static or shared C and C++ runtime.
            Configuration help:
              Configuration file at $boost$\tools\build\v2
              user-config.jam
              This file is used to configure your Boost.Build installation. You can modify
            this file in place, or you can place it in a permanent location so that it
            does not get overwritten should you get a new version of Boost.Build. See:
              http://boost.org/boost-build2/doc/html/bbv2/reference.html#bbv2.reference.init
            for documentation about possible permanent locations.
            General command line usage:
                bjam [options] [properties] [targets]
              Options, properties and targets can be specified in any order.
            Important Options:
              * --clean Remove targets instead of building
              * -a Rebuild everything
              * -n Don't execute the commands, only print them
              * -d+2 Show commands as they are executed
              * -d0 Supress all informational messages
              * -q Stop at first error
              * --debug-configuration Diagnose configuration
              * --debug-building Report which targets are built with what properties
              * --debug-generator Diagnose generator search/execution
            Further Help:
              The following options can be used to obtain additional documentation.
              * --help-options Print more obscure command line options.
              * --help-internal Boost.Build implementation details.
              * --help-doc-options Implementation details doc formatting.
            編譯所有版本:
            bjam --toolset=msvc-8.0 --prefix=$lib-and-dll-out-dir$ --build-type=complete install
            等待編譯完成.
            設(shè)置開發(fā)環(huán)境:
            打開VS2005 選擇 工具->選項(xiàng)->vc++目錄
            設(shè)置包含文件目錄$lib-and-dll-out-dir$\include\boost-1_37\boost
            設(shè)置引用文件目錄:$lib-and-dll-out-dir$\lib
            完成.可以使用了.

            http://anders0913.javaeye.com/blog/375303#


            轉(zhuǎn)自: http://sswflying.spaces.live.com/blog/cns!A1AF9E41EDCAEF99!584.entry
                          http://sswflying.spaces.live.com/blog/cns!A1AF9E41EDCAEF99!515.entry
            posted on 2010-09-07 11:26 會(huì)飛的兔子 閱讀(10474) 評(píng)論(1)  編輯 收藏 引用 所屬分類: C++庫(kù),組件
            久久久久久久久66精品片| 久久综合噜噜激激的五月天| 国产精品美女久久福利网站| 久久国产色av免费看| 亚洲精品乱码久久久久久久久久久久 | 精品久久久无码人妻中文字幕豆芽| 国产精品久久午夜夜伦鲁鲁| 欧美一区二区精品久久| 亚洲综合久久久| 国产精品美女久久久m| 久久久久久久综合综合狠狠| 色综合久久久久久久久五月| 国产—久久香蕉国产线看观看| 久久亚洲国产成人影院| 91精品国产高清91久久久久久| 亚洲国产成人久久一区久久| 亚洲国产精品久久66| 丰满少妇人妻久久久久久| 久久久这里有精品中文字幕| 热99re久久国超精品首页| 中文字幕亚洲综合久久菠萝蜜| 99久久99久久精品免费看蜜桃| 亚洲成av人片不卡无码久久| 色综合久久最新中文字幕| 久久久久久久97| 日本精品一区二区久久久| 色综合久久天天综合| 久久成人国产精品| 亚洲午夜久久久久久久久电影网| 国产精品久久久久蜜芽| 国产成人久久久精品二区三区| 久久这里只有精品18| 99精品久久久久久久婷婷| 亚洲AⅤ优女AV综合久久久| 精品久久久久久无码人妻蜜桃| 久久国产V一级毛多内射| 国内精品人妻无码久久久影院| 久久综合噜噜激激的五月天| 亚洲乱码精品久久久久..| 久久综合久久美利坚合众国| 久久精品综合网|