mercredi 19 octobre 2016

TBB error when compiling

I have the following piece of code that i am trying to execute

#include <iostream>
#include <cstring>
#include "tbb/tbb.h"

using namespace std;
using namespace tbb;

class Accumulate{
    float& arr;
    float* src;

    public:
    Accumulate(float& _arr, float* _src)
    :arr(_arr), src(_src){}
    void operator() (int i) const{
        arr += src[i];
    }

};

int main(int argc, const char * argv[]) {
    float arr[4] = {1,3,9,27};
    float sum = 0;
    parallel_for(0, 4, Accumulate(sum, arr));
    cout<< sum << endl;  
}

I am trying to make use of parllel_for to calculate the sum and this requires the tbb library. I downloaded the source tbb directory and pasted it in my xcode project directory.

When i try to compile the above code, i seem to get the following error 'tbb/internal/_flow_graph_types_impl.h' file not found

I am not sure what i am missing, please advise

Aucun commentaire:

Enregistrer un commentaire