2011-01-25 81 views
4

我想端口的現有項目到iPhone這就需要Boost.Thread庫,項目編譯沒有錯誤,但也有鏈接錯誤:如何將boost線程庫添加到iPhone項目中?

"boost::thread::start_thread()", referenced from: 
    boost::thread::thread<(anonymous namespace)::ReadThread::Function>((anonymous namespace)::ReadThread::Function, boost::disable_if<boost::is_convertible<(anonymous namespace)::ReadThread::Function&, boost::detail::thread_move_t<(anonymous namespace)::ReadThread::Function> >, boost::thread::dummy*>::type)in ChessEngine.o 

我怎麼能要求的線程庫添加到Xcode項目?

p.s.升壓庫在:/usr/local/lib/libboost_thread-mt.a

EDIT(庫中找到,但得到的架構錯誤):

Linking to Boost.Signals using Xcode,在Other Linker Flags將在Library Search Path/usr/local/lib-lboost_thread-mt後,該庫中找到。不過,也有新的錯誤和警告:

ld: warning: in /usr/local/lib/libboost_thread-mt.dylib, file was built for unsupported file format which is not the architecture being linked (i386) 

怎樣纔可以有針對iOS(4.0或更高版本)的lib工作?謝謝!

回答

0

聽起來好像你正試圖鏈接一個架構庫(armv6,7),當你可能把當前目標設置爲一個設備(i386 - 模擬器)。如果這是正確的,我會說你已經下載了爲該設備建立的庫。要在模擬器中運行,您需要爲您的計算機構建的庫版本(I386)。

處理任何外部庫的最簡單方法是由開發人員生成armv6/armv7/i386靜態框架。那麼這是一個小菜一碟使用。如果這聽起來很麻煩,我會在其他地方尋找功能:-)

相關問題