title: How to use boost auto_cpu_timer and progress_display at the same time?
body: <p>I want to to use boost <code>auto_cpu_timer</code> to display the time my complete code needs to run. Additionally i want to see the progress of my loops using <code>progress_display</code>. </p>
  
  <p>It seems there is a namespace confilict as Boost has two timer classes, where <code>progress_display</code> is from the old, now deprecated library.</p>
  
  <p><a href="http://www.boost.org/doc/libs/1_51_0/libs/timer/doc/index.html" rel="nofollow">http://www.boost.org/doc/libs/1_51_0/libs/timer/doc/index.html</a></p>
  
  <p>Still, is there a way to achieve this? The following example shows, what i'm trying to do. Using either <code>AUTO</code> or <code>PROG</code> works fine, but both together result in error messages.</p>
  
  <p><strong>Main:</strong> compiled with <code>g++ -lboost_timer main.cc -o time</code></p>
  
  <pre><code>#define AUTO
  #define PROG
  
  #ifdef  PROG
  #include &lt;boost/progress.hpp&gt;
  #endif     //----  PROG  -----
  
  #ifdef  AUTO
  #include &lt;boost/timer/timer.hpp&gt;
  #endif     //----  AUTO  -----
  
  #include &lt;cmath&gt;
  
  int main()
  {
  #ifdef  AUTO
      boost::timer::auto_cpu_timer t;
  #endif     //----  AUTO  -----
  
      long loops = 100000000;
  
  #ifdef  PROG
      boost::progress_display pd( loops );
  #endif     //----  PROG  -----
  
      //long loop to burn some time
      for (long i = 0; i &lt; loops; ++i)
      {
          std::sqrt(123.456L);
  #ifdef  PROG
          ++pd;
  #endif     //----  PROG  -----
      }
  
      return 0;
  }
  </code></pre>
  
  <p><strong>Error log:</strong></p>
  
  <pre><code>/usr/include/boost/timer/timer.hpp:38:1: error: ‘namespace boost::timer { }’ redeclared as different kind of symbol
  /usr/include/boost/timer.hpp:45:1: error: previous declaration of ‘class boost::timer’
  /usr/include/boost/timer/timer.hpp: In member function ‘std::string boost::timer::cpu_timer::format(short int, const std::string&amp;) const’:
  /usr/include/boost/timer/timer.hpp:74:34: error: ‘format’ is not a member of ‘boost::timer’
  /usr/include/boost/timer/timer.hpp: In member function ‘std::string boost::timer::cpu_timer::format(short int) const’:
  /usr/include/boost/timer/timer.hpp:76:34: error: ‘format’ is not a member of ‘boost::timer’
  main.cc: In function ‘int main()’:
  main.cc:17:2: error: ‘auto_cpu_timer’ is not a member of ‘boost::timer’
  main.cc:17:31: error: expected ‘;’ before ‘t’
  </code></pre>