Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add boost to my project?

I work on a cross-platform (Windows, Linux, Solaris) project. I want to use Boost's shared_ptr in this project.

How can I install it, and redistribute it with the project to the customers?

I don't have root permissions on Linux/Solaris, so I probably have to add Boost' sources to my sources, and build it together.

Also, our version of Solaris is very old (2.5.1, May 1996). Can it cause any problem with the building of shared_ptr?

like image 650
Igor Avatar asked Aug 05 '10 08:08

Igor


1 Answers

Just install the boost header files (you don't need to compile and install the libraries for shared_ptr, because it's header only). Don't forget to check if the include paths for boost are set up right inside your IDE, so it will be able to find the header file.

In your code file, include this header:

#include<boost/shared_ptr.hpp>

and use it like this:

boost::shared_ptr<int> ptrToInt (new int);
like image 115
Christophe Avatar answered Sep 17 '22 18:09

Christophe