I create TBB under MinGW32 (on Windows 7 64 bit) and successfully link a simple program with it. Unfortunately, my colleague cannot successfully link. We both run the same version of Windows, the same version of MinGW (mingw-get-inst-20110802) and try to compile the same code. Our PATH environment variable is exactly the same (.: / Usr / local / bin: / mingw / bin: / bin). Nevertheless, despite the fact that all things are equal (as far as I can tell), I can successfully create and run the program, the attempts of my colleagues failed at the link stage. If I give him tbb.dll, then he will be able to successfully link his program. Thus, I am convinced that something is wrong with its creation of tbb.dll. We have confirmed (using the file) that we are creating 32-bit binaries for all object files and libraries
$ file a.exe a.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit $ file ./tbb/tbb30_20110704oss/lib/tbb.dll ./tbb/tbb30_20110704oss/lib/tbb.dll: PE32 executable for MS Windows (DLL) (console) Intel 80386 32-bit
Command line used to build TBB:
mingw32-make compiler=gcc arch=ia32 runtime=mingw tbb
A simple test program that we compile:
#include <tbb/task_scheduler_init.h> using namespace tbb; int main() { task_scheduler_init init; return 0; }
The command line we use to create a simple test program
g++ test1.cpp -I ./tbb/tbb30_20110704oss/include -L ./tbb/tbb30_20110704oss/lib -ltbb
In my case, he builds and ties flawlessly. In his case, he receives an error message:
test1.o: In function `tbb::task_scheduler_init::task_scheduler_init(int, unsigned int)': test1.cpp:(.text._ZN3tbb19task_scheduler_initC1Eij[tbb::task_scheduler_init::task_scheduler_init(int, unsigned int)]+0x33): undefined reference to `tbb::task_scheduler_init::initialize(int, unsigned int)' test1.o: In function `tbb::task_scheduler_init::~task_scheduler_init()': test1.cpp:(.text._ZN3tbb19task_scheduler_initD1Ev[tbb::task_scheduler_init::~task_scheduler_init()]+0x16): undefined reference to `tbb::task_scheduler_init::terminate()'
It looks like the message indicates that the linker has a problem finding the characters tbb :: task_scheduler_init :: initialize () and tbb_task_schedule_init :: terminate (). However, both of these characters exist in tbb.dll (the nm output below is identical for it and for me):
$ nm ../tbb/tbb30_20110704oss/lib/tbb.dll | grep task_scheduler_init 676c9cb8 T __ZN3tbb19task_scheduler_init10initializeEi 676c9c2c T __ZN3tbb19task_scheduler_init10initializeEij 676c9b64 T __ZN3tbb19task_scheduler_init19default_num_threadsEv 676c9afc T __ZN3tbb19task_scheduler_init9terminateEv
Can someone suggest any suggestions as to why I could build and link this simple example, when my colleague cannot communicate, despite the fact that we use the same exact tools, binaries, source code, operating system etc ??