开发者

How to add boost thread library to an iPhone project?

I am trying to port an existing project to iPhone which needs Boost.Thread library, the project compiles without error but there are link errors:

"boost::thread::start_thread()", referenced from:
  boost::thread::thread<(anonymous namespace)::ReadThread::Function>((anonymous namespace)::ReadThread::Function, boost::disable_if<boost::is_converti开发者_JAVA百科ble<(anonymous namespace)::ReadThread::Function&, boost::detail::thread_move_t<(anonymous namespace)::ReadThread::Function> >, boost::thread::dummy*>::type)in ChessEngine.o

How can I add the required thread libs to the Xcode project?

p.s. the boost lib is in: /usr/local/lib/libboost_thread-mt.a

EDIT (library found, but got architecture error):

Following Linking to Boost.Signals using Xcode, after adding /usr/local/lib in Library Search Path and -lboost_thread-mt in Other Linker Flags, the library is found. However, there are new errors and warnings:

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)

How can I have the lib working for iOS (4.0 or later)? Thanks!


I did some more searching and found this downloadable script that will build a multi-architecture iphone ready version of boost. Also check out this blog post about using it.


It sounds like you are trying to link in a library for an architecture (armv6,7) when you probably have the current target set as a device (i386 - the simulator). If thats correct I'd say you have downloaded the library built for the device. To run in the simulator you need the version of the library built for your computer (I386).

The easiest way to handle any external library is for the developer of it to produce a armv6/armv7/i386 static framework. Then it's a piece of cake to use. If it's as much trouble as this sounds like, I'd be looking elsewhere for the functionality :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜