2014-01-15 92 views
2

我在某處閱讀boost的序列化庫需要編譯的地方(我忘記了它的位置,否則我會發佈一個鏈接)。如何構建boost序列化庫

因此,我從源碼僞造下載了最新版本,並將其提取到我的項目中的路徑。 現在呢?

我調查了該文件夾,但找不到makefile

那麼我需要做些什麼來編譯boost:serialization lib?

編輯:不過我試圖用它來工作,無需編譯,但我得到這個錯誤:

boost/archive/basic_xml_oarchive.hpp:92:9: error: 
no matching function for call to 'assertion_failed' 
    BOOST_MPL_ASSERT((serialization::is_wrapper<T>)); 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

所以我想這樣做的原因是,它並沒有編譯。是對的嗎?

+0

構建Boost的完整說明在這裏:http://www.boost.org/doc/libs/1_55_0/more/getting_started/ – JBentley

+0

@JBentley:ahh ...有我讀的頁面,序列化lib必須被編譯:)。哦...我明白了,還有安裝說明。謝謝 –

回答

7

要構建Boost,請按照說明here

根據您的評論,您只需構建Boost(序列化)的一部分。如果你按照上面的鏈接,存在包含以下建議一節(措辭可能會有所不同,我從Windows指令複製它):

For a description of other options you can pass when invoking b2, type:

b2 --help

In particular, to limit the amount of time spent building, you may be interested in:

  • reviewing the list of library names with --show-libraries
  • limiting which libraries get built with the --with-library-name or --without-library-name options

鍵入b2 --show-libraries產生如下:

The following libraries require building: 
    - atomic 
    - chrono 
    - context 
    - coroutine 
    - date_time 
    - exception 
    - filesystem 
    - graph 
    - graph_parallel 
    - iostreams 
    - locale 
    - log 
    - math 
    - mpi 
    - program_options 
    - python 
    - random 
    - regex 
    - serialization 
    - signals 
    - system 
    - test 
    - thread 
    - timer 
    - wave 

因此,要構建正確的序列化,請將選項--with-serialization更改爲b2建立使用VS2013所有庫類型(靜態/動態庫,靜態/動態運行,調試/釋放,單/多線程),你可以輸入:

b2 toolset=msvc-12.0 --with-serialization --build-type=complete stage

請注意,如果您打算使用的Boost在未來的項目中,建立整個項目可能會更簡單(即省略--with-serialization選項),以便所有庫都可以隨時使用,只要您需要它們即可。

+1

謝謝。在你的建議後,我建立了所有庫。我在第一個開始就得到'link.jam沒有這樣的文件或目錄'。有什麼不對? –

+1

@ Rico-E這整個過程似乎被混淆了。 – bordeo