I am trying 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 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 should I fix this?
Thanks