Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed boost using sudo apt-get install on Ubuntu. Later I did not have to give gcc the I flag alongwith the path to the boost libraries to use boost ! Nor did I do any pkg-config --cflags --libs of any sort. What is the mystery here ? How is gcc able to know where boost is and how is it linking to it automatically ?

share|improve this question
up vote 10 down vote accepted

Boost is a mostly header-only library, so there is no library to link with (most of the time).

As for the headers, Ubuntu place them in /usr/include/, which is one of the include paths GCC use by default. So any #include <boost/foreach.hpp> will work out of the box on Ubuntu.

share|improve this answer
additionally, the lib files are stored in the /usr/lib folder by default – Wildling Mar 3 '13 at 17:10
@RitwikG: Yes, but you still need to link to them explicitly. – BatchyX Mar 3 '13 at 17:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.