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!

+2


a source to share


2 answers


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

for example:

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


Instead:

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


a source


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.



0


a source







All Articles