It is theoretically possible to use a boost library (e.g. boost threads) inside a cocoa project?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes, there is nothing stopping you from doing that:
- you can mix Objective-C and C++ - the result is called Objective-C++
- you can of course also link to C and C++ libraries
回答2:
Yes. You can compile boost as a static library and link against it, or you can add the source code to your project and compile it with it.
回答3:
Yeah, just make sure you use Objective-C++ and include to the boost directories you need. (Note: to change to objective-C++ change the file extension to .mm instead of .m, and keep the .h files the same)