title: linking to boost regex in gcc
body: <p>i am trying to compile my program which uses regex on linux. I built the boost library in the
      libs/regex/build
  by typing
      make -fgcc.mak
  which created a directory gcc which contains the following four files</p>
  
  <pre><code>boost_regex-gcc-1_35
  boost_regex-gcc-d-1_35
  libboost_regex-gcc-1_35.a
  libboost_regex-gcc-d-1_35.a
  </code></pre>
  
  <p>Now I want to use regex from my program which is in some arbitrary directory. 
  I #included boost/regex.hpp</p>
  
  <p>I got the error which stated that regex.hpp is not found. Then I gave the -I option in the g++ compiler. I didn't get that error.
  But I get the following error</p>
  
  <pre><code>undefined reference to `boost::re_detail::perl_matcher&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;boost::sub_match&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; &gt;, boost::regex_traits&lt;char, boost::cpp_regex_traits&lt;char&gt; &gt; &gt;::construct_init(boost::basic_regex&lt;char, boost::regex_traits&lt;char, boost::cpp_regex_traits&lt;char&gt; &gt; &gt; const&amp;, boost::regex_constants::_match_flags)'
  </code></pre>
  
  <p>I googled and found that I need to somehow link one of the above 4 libraries to my program. How can I do it. Which one should I link and why? </p>