title: trouble linking INTEL tbb library
body: <p>I read these threads:</p>
  
  <p><a href="https://stackoverflow.com/questions/5586396/getting-thread-building-blocks-intel-tbb-running-on-linux-with-gcc">Getting Thread Building Blocks (Intel TBB) running on Linux with gcc</a></p>
  
  <p><a href="https://stackoverflow.com/questions/25819871/unable-to-link-intel-tbb-library-with-libtbb-in-usr-lib">unable to link Intel TBB library with libtbb in /usr/lib</a></p>
  
  <p><a href="https://stackoverflow.com/questions/13938298/g-cant-find-headers-even-when-its-specified">g++ can&#39;t find headers even when it&#39;s specified</a></p>
  
  <p><a href="https://stackoverflow.com/questions/8736106/g-cannot-find-header-file">g++ cannot find header file</a></p>
  
  <p><a href="https://stackoverflow.com/questions/21435690/g-cant-find-headers-but-i-did-include-them">g++ can&#39;t find headers but I did include them</a></p>
  
  <p>but still get this error:</p>
  
  <pre><code>   piCalc.cpp:8:17: fatal error: ttb.h: No such file or directory
   #include "ttb.h"
  </code></pre>
  
  <p>My code to calculate pi starts with</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "ttb.h"
  #include "parallel_for.h"
  </code></pre>
  
  <p>Running Ubuntu 14.04 with nvidia and cuda installed.
  To install TBB, I started with :</p>
  
  <pre><code>sudo apt-get install libtbb-dev
  </code></pre>
  
  <p>and it said</p>
  
  <pre><code>Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  libtbb-dev is already the newest version.
  The following package was automatically installed and is no longer required:
    libxine2-bin
  Use 'apt-get autoremove' to remove it.
  0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  </code></pre>
  
  <p>So I thought I was good to go. So, I tried:</p>
  
  <pre><code>g++ piCalc.cpp -ltbb -o pi 
  </code></pre>
  
  <p>and get the error. So I downloaded the archive from intel and decompressed it to my home directory into a directory named tbb.</p>
  
  <p>Issuing ls gives:</p>
  
  <pre><code>CHANGES  COPYING  README  bin  doc  examples  include  index.html  lib  piCalc.cpp
  </code></pre>
  
  <p>Notice piCalc.cpp is in the tbb directory. Also, tbb.h is located at /include/tbb
  So I changed the include statements to</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "/include/tbb/ttb.h"
  #include "/include/tbb/parallel_for.h"
  </code></pre>
  
  <p>libtbb.so and libtbb.so.2 are located at lib/intel64/gcc4.4</p>
  
  <p>My terminal command was issued thusly:</p>
  
  <pre><code>g++ piCalc.cpp  -o pi -I include/tbb -L lib/intel64/gcc4.4 -ltbb
  </code></pre>
  
  <p>as well as</p>
  
  <pre><code>g++ piCalc.cpp  -o pi -I include/tbb/ -L lib/intel64/gcc4.4/ -ltbb
  </code></pre>
  
  <p>as well as</p>
  
  <pre><code>g++ piCalc.cpp  -o pi -I /include/tbb -L /lib/intel64/gcc4.4 -ltbb
  </code></pre>
  
  <p>and the same error occurs</p>
  
  <pre><code>piCalc.cpp:8:30: fatal error: /include/tbb/ttb.h: No such file or directory
   #include "/include/tbb/ttb.h"
  </code></pre>
  
  <p>I tried absolute paths with this:</p>
  
  <pre><code>g++ piCalc.cpp -I /home/stefan/tbb/include/tbb -L /home/stefan/tbb/lib/intel64/gcc4.4 -ltbb -o pi
  </code></pre>
  
  <p>Still same error.</p>
  
  <p>I tried changing my code to:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;/home/stefan/tbb/include/tbb/ttb.h&gt;
  #include &lt;/home/stefan/tbb/include/tbb/parallel_for.h&gt;
  </code></pre>
  
  <p>and get this:</p>
  
  <pre><code>stefan@HN5:~/tbb$ g++ piCalc3.cpp -I /home/stefan/tbb/include/tbb -L /home/stefan/tbb/lib/intel64/gcc4.4 -ltbb -o pi
  piCalc3.cpp:8:46: fatal error: /home/stefan/tbb/include/tbb/ttb.h: No such file or directory
   #include &lt;/home/stefan/tbb/include/tbb/ttb.h&gt;
                                                ^
  compilation terminated.
  </code></pre>
  
  <p>Basically the same error but more verbose since I used the absolute path in the terminal command.</p>
  
  <p>I thought maybe the LD_LIBRARY_PATH variable was important. CUDA messes with the LD_LIBRARY_PATH variable so I exported the intel libs and now printenv shows:</p>
  
  <pre><code>LD_LIBRARY_PATH=/home/stefan/tbb/lib/intel64/gcc4.4:/usr/local/cuda-7.5/lib64:
  </code></pre>
  
  <p>still getting the error.</p>
  
  <p>Here is the verbose error:</p>
  
  <pre><code>stefan@HN5:~/tbb$ g++ piCalc.cpp -o pi -v -I/home/stefan/tbb/include/tbb -L/home/stefan/tbb/lib/intel64/gcc4.4 -ltbb 
  Using built-in specs.
  COLLECT_GCC=g++
  COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
  Target: x86_64-linux-gnu
  Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
  Thread model: posix
  gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.1) 
  COLLECT_GCC_OPTIONS='-o' 'pi' '-v' '-I' '/home/stefan/tbb/include/tbb' '-L/home/stefan/tbb/lib/intel64/gcc4.4' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
   /usr/lib/gcc/x86_64-linux-gnu/4.8/cc1plus -quiet -v -I /home/stefan/tbb/include/tbb -imultiarch x86_64-linux-gnu -D_GNU_SOURCE piCalc.cpp -quiet -dumpbase piCalc.cpp -mtune=generic -march=x86-64 -auxbase piCalc -version -fstack-protector -Wformat -Wformat-security -o /tmp/ccHq7bTl.s
  GNU C++ (Ubuntu 4.8.4-2ubuntu1~14.04.1) version 4.8.4 (x86_64-linux-gnu)
      compiled by GNU C version 4.8.4, GMP version 5.1.3, MPFR version 3.1.2-p3, MPC version 1.0.1
  GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
  ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/4.8"
  ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
  ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/include"
  #include "..." search starts here:
  #include &lt;...&gt; search starts here:
   /home/stefan/tbb/include/tbb
   /usr/include/c++/4.8
   /usr/include/x86_64-linux-gnu/c++/4.8
   /usr/include/c++/4.8/backward
   /usr/lib/gcc/x86_64-linux-gnu/4.8/include
   /usr/local/include
   /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed
   /usr/include/x86_64-linux-gnu
   /usr/include
  End of search list.
  GNU C++ (Ubuntu 4.8.4-2ubuntu1~14.04.1) version 4.8.4 (x86_64-linux-gnu)
      compiled by GNU C version 4.8.4, GMP version 5.1.3, MPFR version 3.1.2-p3, MPC version 1.0.1
  GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
  Compiler executable checksum: 83f8d9bb238019ed17000f1b7e141e5a
  piCalc.cpp:8:30: fatal error: /include/tbb/ttb.h: No such file or directory
   #include "/include/tbb/ttb.h"
                                ^
  compilation terminated.
  </code></pre>
  
  <p>I also get this error if I copy the include/tbb folder which has all the .h files into the  /usr/local/include folder. I also tried brackets instead of quote for the include files in the source.</p>
  
  <p>Since my brain is in a deep rut by now, I am hoping someone can help me by pointing out what I am missing.</p>