Installing tbb in windows

Installing tbb in windows

I am using windows XP. I have Visual studio 2005 installed in my system. I downloadedtbb "Stable Release" from this site and tried to follow the instructions to install it in my system. I did not understand where to place what files. I understood the lib and include folders to be moved to some system folders, I thinkunder "C:Program FilesMicrosoft Visual Studio 8". But I did not understand much. And I found something about GNU. Even that one, I am not able to understand much.

Could anybody help me in installing and using tbb?

I am a VB developer. So, the questions I am asking may be very minor for a c++ developer.

Thanks in advance.

8 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

It's less important WHERE you place the files (the binaries from the Windows distribution file and the include files from the source distribution file), as how you connect them to VS.NET. There are a couple of ways to do that. One is to get the INCLUDE, PATH and LIB paths modified to include the appropriate TBB components before launching VS (either by setting the global environment, or by setting a shell environment before manually launching VS via devenv.exe), or by setting these directories in the appropriate paths with VS (Tools >> Options >> Projects and Solutions >> VC++ Directories).

If you look in the binary distribution, say tbb20_20070927oss_winia32vc8in, you'll find a file, tbbvars.bat, that can be used with some preparation. You'll note this file expects the ia32 (or em64t) and include directories to be in the same place, which is expected to be set in an environmental variable, TBB20_INSTALL_DIR. Set this to the place where you put those folders and you could use this batch file to set the environment in a shell before launching devenv.exe (VS.NET)

This should at least get you started.

Hi,

As you said, I added the environment variable "TBB20_INSTALL_DIR" and set its path to the path of the folder where I have abstracted the downloaded files. And executed the bat file by double clicking that file.

And then I added the lib and bin paths to the Tools >> Options >> Projects and Solutions >> VC++ Directories.

Then I tried toexecute the project, which is a winning solution for perfect numbers. It gaveme error "Error1fatal error C1083: Cannot open include file: 'tbb/task_scheduler_init.h': No such file or directoryf:perfect numberwinning solutionprime.cpp6". This error was occuring at the line where there was declaration "#include "tbb/task_scheduler_init.h"

I dida trail and error, and placed the folder "tbb" [which was taken from "tbb20_20071218oss_src"] in that solution folder. After that I am getting the error "Error1fatal error C1189: #error : The library requires dynamic linkage with multithreaded MSVC runtime. Choose proper project settings or use /MD[d] compiler switch.f:perfect numberwinning solution bb_tbb_windef.h39"

Colud you please let me know what am I missing.

Thanks in advance,

Swapna.

I have a couple of suggestions for you. I question the technique you used to run tbbvars.bat by double clicking on it. If the batch file had worked, it would have set the lib and bin paths. But executing it via a double click, it will spawn a shell window very briefly--I could see it flash on the screen--in which the settings are made, but the settings go away along with the context of that transient shell window. What I was suggesting was something more like this

Start a shell window and in it type:

set TBB20_INSTALL_DIR=C:Apps bb20_20070927oss_win
C:Apps bb20_20070927oss_winia32vc8in bbvars.bat
C:Program FilesMicrosoft Visual Studio 8Common7IDEdevenv.exe

That should set PATH, LIB and INCLUDE in a shell context that gets inherited by VS.NET. Assuming that both include and ia32 directories (or em64t if you're working in 64-bits) have been included in your install directory, the INCLUDE directory for TBB should be visible to VS, avoiding the C1083 error you reported above. Making the TBB include directory part of the project is a costly but quick alternate to setting INCLUDE.

The dynamic linkage error you report is because TBB is distributed only as a shared library, to make it easier to maintain a singleton object for initialization of things like the thread pool. You would get such an error by trying to link TBB with static VC runtimes. You must select /MD, which you can do in VS under C/C++ >> Code Generation >> Runtime Library in the solution property pages.

Thanks mad...

But I think I am missing some thing. Even after doing this the first problem C1083 is stillcoming, if I remove the tbb folder from the application folder. But I dont think placing that folder in application folder is aright way.

The 2nd error is not coming any more after changing the code generation>>Runtim library property.

Is this tbbintended for c, c++, vc++alone??? Not for c# or some other language?

Yes, TBB is only for C++ and not other language.

I suggest you look into the "a question to start using TBB" thread for some advice about how to set up the environment for using TBB from Visual Studio. In particular,

  • ensure you unpacksource and binary packages into the same folder, or copy unpacked content into the same folder later;
  • set TBB20_INSTALL_DIR to point to this folder;
  • run the appropriate tbbvars.bat file from console windows
  • run devenv with/useenv option from the same window so that Visual Studio inherits environment settings you have made as per above

I agree it's not quite friendly way; we are working on more convenient solution.

Thanks for the link.

I found what mistake I was doing. Instead of pointing to "include" folder, I was pointing to "include bb". Now I am not getting the .h files missing error for one of the winning solution, I was looking into.

But as awh mentioned in the "a question to start using TBB" thread, I am getting the same errors as listed below, when I am trying to run the examples in the source folder "tbb20_20071218oss_src":

Error1error LNK2001: unresolved external symbol "public: virtual void __thiscall tbb::task::note_affinity(unsigned short)" (?note_affinity@task@tbb@@UAEXG@Z)count_strings.obj
Error2error LNK2019: unresolved external symbol "public: void __thiscall tbb::internal::task_scheduler_init_v3::initialize(int,unsigned int)" (?initialize@task_scheduler_init_v3@internal@tbb@@QAEXHI@Z) referenced in function "public: __thiscall tbb::internal::task_scheduler_init_v3::task_scheduler_init_v3(int,unsigned int)" (??0task_scheduler_init_v3@internal@tbb@@QAE@HI@Z)count_strings.obj
Error3error LNK2019: unresolved external symbol "public: void __thiscall tbb::internal::task_scheduler_init_v3::terminate(void)" (?terminate@task_scheduler_init_v3@internal@tbb@@QAEXXZ) referenced in function "public: __thiscall tbb::internal::task_scheduler_init_v3::~task_scheduler_init_v3(void)" (??1task_scheduler_init_v3@internal@tbb@@QAE@XZ)count_strings.obj
Error4fatal error LNK1120: 3 unresolved externalsC:DOCUME~1swapnamLOCALS~1Temp bb_examplesReleasecount_strings.exe

>>you should also add tbb_debug.lib (for Release configuration, usetbb.lib) into your project settings as an additional library to link with. Frankly, this is the necessary step if you use any 3rd-party DLL.

And asAlexey suggested in that thread, Iadded tbb_debug.lib as well in the project settings. But I am still getting the above errors.

Can anybody help me in solving this as well?

Sorry for troubling you all. Just now I noticed, that I am using a combination of tbb20_20071218oss_src.tar and tbb20_20070927oss_win.tar. I think this is the reason for the above mentioned problem. I will check myself by using the source files from tbb20_20070927oss_src.tar and let you know whether it resolved or not.

Thanks for your time and patience.

Swapna.

Leave a Comment

Please sign in to add a comment. Not a member? Join today