title: how to get Threaded Building Blocks working in Ubuntu 14.04
body: <p>I want to get TBB working, but I'm having a little difficulty getting the compiling to work on Ubuntu 14.04. I think it is likely a problem with setting the location of libraries for the compiler.</p>
  
  <p>I installed TBB using the following command:</p>
  
  <pre><code>sudo apt-get install libtbb-dev
  </code></pre>
  
  <p>I have a small test example that I am now trying to compile. The code is as follows:</p>
  
  <pre><code>#include "tbb/task_scheduler_init.h"
  
  int main(int argc, char* argv[]) {
      tbb::task_scheduler_init init;
      return 0;
  }
  </code></pre>
  
  <p>The command I am running to compile this code is as follows:</p>
  
  <pre><code>g++ -std=c++11 -g -O2 -ltbb simple_test.cc -o simple_test
  </code></pre>
  
  <p>I am running this with G++ version 4.9.1. When I try to compile, I get the following errors:</p>
  
  <pre><code>/tmp/cc7Ls8Sb.o: In function `task_scheduler_init':
  /usr/include/tbb/task_scheduler_init.h:126: undefined reference to `tbb::task_scheduler_init::initialize(int, unsigned long)'
  /tmp/cc7Ls8Sb.o: In function `~task_scheduler_init':
  /usr/include/tbb/task_scheduler_init.h:132: undefined reference to `tbb::task_scheduler_init::terminate()'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>The location of the file <code>task_scheduler_init.h</code> is <code>/usr/include/tbb/task_scheduler_init.h</code>.</p>
  
  <p>Would you have any idea what I'm doing wrong?</p>
  
  <hr>
  
  <p>EDIT: I reordered the arguments for g++ and this got it working:</p>
  
  <pre><code>g++ simple_test.cc -std=c++11 -g -O2 -ltbb -o simple_test
  </code></pre>
  
  <p>I don't really understand why this change has made the compiling successful.</p>