Search
Support & Downloads
All of Support
This Category
Software Products
Performance Tools for Software Developers
Using the Intel® C++ Compiler and the Intel® Threading Building Blocks

  1. Introduction

    This guide is intended to help the Intel® C++ Compiler customers to use the Intel® Threading Building Blocks (TBB) to thread applications and build the applications with Intel C++ Compiler. It covers Windows*, Linux* and Mac OS* X Operating Systems.

  2. Version information and where to download

    1. The latest Intel C++ Compiler is 10.1 release. To get a free 30-day eval version, visit Intel® Software Evaluation Center.

    2. The latest TBB is 2.0 release. You can download it free from http://threadingbuildingblocks.org/*.

  3. Prerequisites

    Both Intel C++ Compiler for Windows* and TBB for Windows require a version of Visual Studio*. Please read the system requirements below.

    1. For Intel C++ Compilers system requirements, please visit following links:

    2. For TBB system requirements, please visit here Threading Building blocks.org*.

  4. Set build environment

    Windows*

    • Set the command window with Visual Studio* 2005 compatibility:

      1. Open the Intel C++ Compiler Build Environment by selecting Start » All Programs » Intel® software development tools » Intel C++ Compiler 10.x.x.x » C++ Build Environment for Applications running on [IA32 | Intel® 64]. This sets up the environment to use the Intel C++ Compiler.

      2. Run TBB .bat file from the above build environment window to setup the environment to include TBB directories.

        >> [tbb-install-dir-root]\2.0\ia32\vc8\bin\tbbvars.bat or >> [tbb-install-dir-root]\2.0\em64t\vc8\bin\tbbvars.bat

      3. Now you can compile your application that uses TBB with Intel C++ Compiler. E.G.:

        >> icl -c tbb_app.cpp >> xilink tbb_app.obj tbb.lib tbbmalloc.lib
    • Set the Visual Studio 2005* IDE to build applications using TBB and Intel C++ Compiler:

      1. Make sure you have installed the Visual Studio Integrations Component from Intel C++ Compiler. To check, open the Visual Studio 2005, select menu Help, if you see Intel(R) C++ Compiler Help, it means you do have it installed.

      2. To add TBB directories to Visual Studio 2005, open Visual Studio 2005, select menu Tools » Options. It will open the Options dialog and select Projects and Soution » VC++ Directories in the left side, add following directories:

        • Add [tbb-install-dir-root]\2.0\ia32\vc8\bin to directory list of Executable files for platforms you'd like i.e. Win32, x64" and Itanium.

        • Add [tbb-install-dir-root]\2.0\ia32\vc8\lib to directory list of Library files for the same platforms.

        • Add [tbb-install-dir-root]\2.0\include to directory list of Include files for the same platforms.

      3. Open your application from Visual Studio 2005, convert the solution or some projects to use Intel C++ Project System by right click on the projects in Solution Explorer and select Convert to use Intel C++ Project System in the pop-up menu.

      4. Now you're ready to use TBB and compile those projects with Intel C++ Compiler.

    Mac OS* X

    • Set the command window on Mac OS* X:

      1. Open a terminal window and source the Intel C++ Compiler script iccvars.sh:

        $ source /opt/intel/cc/10.1.xxx/bin/iccvars.sh
      2. In the same terminal window, source the TBB script tbbvars.sh:

        $ source /Library/Frameworks/Intel_TBB.framework/Versions/2.0/bin/tbbvars.sh
      3. Now you can use Intel C++ Compiler to build your application that uses TBB like below:

        $ icpc -c tbb_app.cpp $ icpc tbb_app.o tbb.lib tbbmalloc.lib
      4. Set Xcode* to use TBB and Intel C++ Compiler:

      5. Open your mytest.xcodeproj with Xcode.

      6. Open the Project mytest Info dialog to add the TBB paths to the project:

        1. Set Configurations field to All Configurations

        2. Select Build tab on the Project Info dialog, scroll down to Search paths section, Add [tbb-install-dir-root]\2.0\include to Header Search Paths.

        3. Add [tbb-install-dir-root]\2.0\include to Library Search Paths

        4. Close the Project Info dialog.

      7. Next is to set the compiler to Intel C++ Compiler:

        1. Select one of the Targets under Groups & Files, then click Info button on top. It opens the Target Info dialog.

        2. Select Rules" tab, click + button to add a new setting. Then on the new setting box, set Process as C++ Source Files, set using as Intel C++ Compiler 10.x.

        3. Click + button again to add a new setting for C Source Files using Intel C++ Compiler 10.x like above.

        4. Close this Target Info dialog.

      8. Now you can build the program that uses both TBB and Intel C++ Compiler.

    Linux*

    • Set the command window:

      1. Open a terminal window and source the Intel C++ Compiler script iccvars.sh:

        $ source /opt/intel/cc/10.1.xxx/bin/iccvars.sh
      2. In the same terminal window, source the TBB script tbbvars.sh:

        $ source /opt/intel/tbb/2.0/bin/tbbvars.sh
      3. Now you can use Intel C++ Compiler to build your application that uses TBB like below:

        $ icpc -c tbb_app.cpp $ icpc tbb_app.o tbb.lib tbbmalloc.lib
    • Set Eclipse* to use TBB and Intel C++ Compiler:

      1. Intel C++ Compiler 10.x supports Eclipse 3.2.x and CDT 3.1.x.

      2. Start Eclipse by following command:

        $ iccec
      3. Open an existing Intel C/C++ Compiler project - see "Build Applications in Eclipse" in the User's Guide.

      4. Select your project in the C/C++ Projects view, then select menu Project &rquao; Properties » C/C++ Build. You should see Properties for yourproject dialog:

        1. Select C/C++ Build on the left, under Configuration settings list, you can add the TBB include -I[tbb-install-dir-root]\2.0\include to Command Line under the C Compiler.

        2. Add the additional TBB lib directory -L[tbb-install-dir-root]\2.0\lib or Command Line under Linker.

        3. Close the properties dialog.

      5. Now you can build the project.

  5. Other useful links

This applies to:
Intel® C++ Compiler for Linux*
Intel® C++ Compiler for Mac OS*
Intel® C++ Compiler for Windows*

Solution ID: CS-028650
Date Created: 12-Dec-2007
Last Modified: 07-Jan-2008
Back to Top