Friday, April 24, 2009

Programming: Installing Boost in your XCode Project

Recently, I tried to implement thread in C++. It led me to Boost library for C++. Its a huge library (not specifically for thread). You can learn/download about this library in here.

The problem is the "getting started" page does not come with XCode project installation. So after a few minutes googling around, I found out the step to install this library properly. Notice that I'm using Cocoa framework, so playing around with Makefile is not that helpful**. 

1. Download the latest Boost from the site. 
2. Extract the package
3. Open terminal, go to the path you extract the file, eg: 
cd /Users/jostimantatarigan/downloads/boost_1_38_0

4. type ./configure 
5. type sudo make install 
Make sure you know your password, and if theres a failure in the beginning, just cancel the process and try to figure out the failure. The build process goes on even if there are failures in the process. 

6. As a default, the library will be installed in /usr/local/
There will be 2 folder named include and lib. Make sure there's a boost files in them.

7. Now go to XCode, open your project.
8. Right Click the project, click Get Info
9. In build tab, make sure the selected configuration is for "All Configuration" (not just Debug or Release")

10. Under "Search Paths":
Find Header Search Paths, add a path /usr/local/include/boost-1_38 
Find Library Search Paths, add a path /usr/local/include/boost-1_38
Please notice the version of the boost. I install version 1_38. 

The installation steps ends here. Try to include one file in boost library eg: boost/python.hpp
Build and Run the program. It should work properly.

Its that easy :) 


**correct me if im wrong :)

No comments: