2012-06-12 55 views
2

我想編譯一些源代碼。但是它會拋出一些與boost庫有關的錯誤。以下是錯誤編譯問題與提升庫

undefined reference to `boost::re_detail::get_mem_block()' 
main.cpp:(.text+0x40a6): undefined reference to `boost::re_detail::verify_options(unsigned int, boost::regex_constants::_match_flags)' 
main.cpp:(.text+0x40db): undefined reference to `boost::re_detail::put_mem_block(void*)' 
main.cpp:(.text+0x430a): undefined reference to `boost::re_detail::put_mem_block(void*)' 
main.o: In function `_ZN7Command12createVectorIdEEvRKSsRSt6vectorIT_SaIS4_EES4_.constprop.1207': 
main.cpp:(.text+0x436e): undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)' 
main.cpp:(.text+0x439f): undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)' 
main.cpp:(.text+0x43d0): undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits< 

我已經安裝在我的系統升壓正則表達式庫,我已經給使用-L選項的路徑圖書館和指定使用-lboost_regex選項以及圖書館。可能是什麼問題?

它找到了庫。但仍然拋出一個錯誤

+1

你試過添加'-lboost_regex'嗎? (沒有'lib')。 – kennytm

+0

什麼是實際的編譯器命令? – juanchopanza

+0

g ++ main.cpp -lboost_regex -lboost_iostreams -L/usr/lib -o main.o –

回答

0

我遇到了同樣的問題,它已被解決。所以也許你之前安裝了一個較舊版本的boost,並且鏈接器鏈接了舊版本。

試着刪除所有安裝的boost庫,並重新安裝boost庫,你的問題就解決了。