How do I bind to Intel TBB on Mac OS X with GCC?
I cannot for life figure out how to compile and link with the Intel TBB library on my Mac. I ran a commercial installer and a tbbvars.sh script but I cannot figure it out. I have a feeling that this is really obvious, and it took too long since I did things like this.
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
... cannot find symbols.
Hooray!
UPDATE:
g++ tbb_test.cpp -I /Library/Frameworks/TBB.framework/Headers -L /Library/Frameworks/TBB.framework/Libraries/libtbb.dylib
working!
a source to share
According to the TBB Getting Started Guide (page 3 of the current version), there are some scripts in the $ INSTALL / bin directory that will set the correct environment variables if you run on them source
(for example source bin/tbbvars.sh
). Once you do that, you no longer need to specify -I
and -L
on the command line g++
, which is tedious, error prone, and most importantly, ugly. But you should still use -ltbb
: '(This advice also applies to those using other Unix-like operating systems such as Linux.
a source to share