views:

264

answers:

1

I can't for the life of me figure out how to compile and link against the Intel TBB library on my Mac. I've run the commercial installer and the tbbvars.sh script but I can't figure this out. I have a feeling it is something really obvious and it's just been a bit too long since I've done this kind of thing.

tbb_test.cpp

#include <tbb/concurrent_queue.h>

int main() {
    tbb::concurrent_queue<int> q;
}

g++ tbb_test.cpp -I /Library/Frameworks/TBB.framework/Headers -ltbb

...can't find the symbols.

Cheers!

UPDATE:

g++ tbb_test.cpp -I /Library/Frameworks/TBB.framework/Headers -L /Library/Frameworks/TBB.framework/Libraries/libtbb.dylib

works!

+2  A: 

Since you are using a framework instead of a traditional library, you need to use -framework, like:

g++ tbb_test.cpp -o tbb_test -framework TBB

Instead of:

g++ tbb_test.cpp -o tbb_test -I /Library/Frameworks/TBB.framework/Headers -ltbb
Michael Aaron Safyan
Thanks, but I couldn't get that to work either. Cheers!
SilverSun
`-framework` isn't documented much in the manpage, but I think it indicates you want to *build* a framework. My best theory about his problem is that `tbb` needs capitalization.
Potatoswatter
@Potatoswatter, "-framework" is in the documentation on Mac OS X (it's an Apple extension to GCC). It means you want to link against the framework, not that you want to build one. For example, to link against the Foundation framework, you use "-framework Foundation".
Michael Aaron Safyan