Ive downloaded TBB (tbb21_20080605oss) from this site, made simple application in Microsoft Visual Studio 2008 Express based on tree_sum sample.It works fine on my PC (Vista SP1/Core 2 Quad 2.4 Ghz).But when Im trying to start it on other computers (such as XP SP2/Pentium D 3 Ghz) I get an could not launch the application error.
Depends.exe shows that all needed dlls are present (tbb.dll, tbbmalloc.dll, msvcp90.dll, msvcr90.dll).
What could be the cause?
Have you installed "Express" or the Microsoft runtime redistribution package on your other machines? I haven't worked with "Express" but I do know that since Microsoft Visual Studio 2005 or so, running programs compiled with VS on other machines require the installation of a redistribution package of libraries, else you get a very cryptic message along the lines of what you describe.
I think that MSVC run-time is not installed on that machines.
The fact that msvcp90.dll, msvcr90.dll are situated near the executable is not enough. DLLs must be installed into SxS.
Here you can see how to create installer of your program which will include and correctly install MSVC run-time:
(see "Community Content" section)
If you need self-contained executable, you can try following.
Compile your application with static versions of MSVC run-time (Project Properties -> C/C++ -> Code Generation -> Runtime Library -> Multi-threaded [Debug]).
Statically link TBB and TBBmalloc. Include all TBB and TBBmalloc sources into your project. Define USE_WINTHREAD and __TBB_TASK_CPP_DIRECTLY_INCLUDED=1. Manually call mallocThreadShutdownNotification() on thread end, and mallocProcessShutdownNotification() on program end.
This approach has some advantages (apart from the fact that it not 100% documented, however has some support in TBB sources):
- single executable
- no dependencies
- faster code, especially if you use LTCG
- possibly smaller size (linker is able to strip unused functionality)
Btw, you can automatically detect such events as process start/end, thread start/end.
See here for details: