I just started learning OpenMP. I tried to compile a simple Hello World C code using gcc.
Here's is my command line .
gcc -fopenmp HelloWorld.c
and this is my simple HelloWorld code .
#include<omp.h>
int main()
{
#pragma omp parallel
{
int ID = 0;
Printf(“hello(%d)”,ID);
printf(“world(%d)”,ID);
}
}
and when i try to compile in OS X. It showed the following error .
clang: error: unsupported option '-fopenmp'
It worked after installing gcc through Homebrew
Install Homebrew
ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install gcc
brew install gcc
and code compiled after using this command line.
gcc-7 -fopenmp HelloWorld.c