Reputation: 4685
I am trying to compile the code:
#include <stdio.h>
#include <omp.h>
int main(){
#pragma omp parallel
{
printf("%d\t%d\n",omp_get_thread_num(), omp_get_num_threads());
}
return 0;
}
I tried both cc -o main.exe main.c and gcc -o main.exe main.c
Both ways I get "fatal error: 'omp.h' file not found"
So I downloaded the latest version of OpenMP. Then in the terminal in the directory of the downloaded folder I typed make and then
sudo cp ./libiomp5.dylib /usr/lib/
but I am still having the same issue. How can I get this to compile?
Upvotes: 0
Views: 305
Reputation: 620
You should guard the Openmp include and function calls with #if _OPENMP in order to support compiling without the openmp option (gcc -fopenmp).
Upvotes: 1