Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use C++ Boost library with pkg-config?

Tags:

I successfully compiled and installed the latest version of the Boost library onto my linux machine. Now, I would like to be able to use pkg-config to ease the process of providing linking paremeters with GCC.

Since I am too lazy for hand-coding my own .pc file, is there a script/tool which would automatically generate the needed .pc file or in some other way update pkg-config with boost flags?

(If someone already has that .pc file, a share would be welcome as well.)

like image 241
eold Avatar asked Oct 19 '10 18:10

eold


People also ask

How do I import Boost into CPP?

Go to Project properties → C/C++ → General → Additional Include Directories, and add a path to the boost library root (in my case C:\Program Files (x86)\Boost_1_53 ). Include a . hpp file in your sources, like #include <boost/lexical_cast/lexical_cast_old. hpp>

Can I build Boost with Cmake?

One of my current projects relies on Boost. Python, which requires a more recent version of Boost (1.64) than the one (1.54) provided by my Linux distribution (Ubuntu 14.04).

What is Boost library C++ 11?

Boost is a set of libraries for the C++ programming language that provides support for tasks and structures such as linear algebra, pseudorandom number generation, multithreading, image processing, regular expressions, and unit testing. It contains 164 individual libraries (as of version 1.76). Boost.


1 Answers

What you're looking for seems to be a bit complicated, and a long-requested feature, as indicated in this 3 year old post https://svn.boost.org/trac/boost/ticket/1094 on Boost's trac. Reading through it shows that the feature was repeatedly postponed and never implemented (as of 1.4.3). The cause of the inability to generate a .pc file usable by pkg-config happens to do with boost's inconsistency in naming their library versions / build variants.

FWIW, an alternative for "automating" your building process is to use autotools (autoconf/automake). There's a link that might be of use to you (which I can't post because SO thinks I'm a spammer instead of a newcomer!), just google "tsuna boost m4 github" and it should take you there :)

like image 146
amireh Avatar answered Sep 27 '22 20:09

amireh