I am trying to compile an OpenMP prject in Clion on Mac.
I have tried
How to set up basic openMP project in CLion
How to set linker flags for OpenMP in CMake's try_compile function
But they all don't work for me. Clion just says:
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)
I also tried compile it using "gcc -o main -fopenmp main.c" in the command line and it works fine.
Here is the code:
#include <stdio.h>
#include <omp.h>
int main() {
printf("Hello, World!\n");
#pragma omp parallel
printf("Hello world from thread %d\n",omp_get_thread_num());
return 0;
}