I am trying to run a simple "Hello world" program using OpenMP. This is my program (helloworld.cpp):
#include <iostream>
int main (){
// begin parallel region
#pragma omp parallel
{
std::cout << "Hello world!" << std::endl;
}
return 0;
}
I am trying to get this to run with the default number of threads, whatever that might be.
This is what I am running:
$ g++ -Xpreprocessor -fopenmp helloworld.cpp
Undefined symbols for architecture arm64:
"___kmpc_fork_call", referenced from:
_main in helloworld-e5c8d6.o
ld: symbol(s) not found for architecture arm64
The version of clang++ I have is:
g++ --version
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: arm64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I am running my work on a M1 Big Sur, 2021.
I have installed the compilers and libomp using Homebrew.
How do I go about making this work?