Library not found for -lgomp

I am trying to create a basic openmp program on mac osx. I am on Mavericks and have the latest Xcode.

#include <cmath>
int main()
{
        const int size = 256;
        double sinTable[size];

        #pragma omp parallel for
        for(int n=0; n<size; ++n)
                sinTable[n] = std::sin(2 * M_PI * n / size);

        // the table is now initialized
}

When I compile the code from the terminal as g++ Test.cpp -fopenmp, I get the following error:

ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)

How do I fix this?

thank

+3
source share

All Articles