0

I followed the instructions here: Using x86 libraries and OpenMP on macOS arm64 architecture

I am trying to compile simple code:

#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
 
int main(int argc, char* argv[])
{
    #pragma omp parallel
    {
        printf("Hello World... from thread = %d\n",
               omp_get_thread_num());
    }
}

using:

/usr/local/opt/llvm/bin/clang++ -arch x86_64 main.cpp

but I am getting error:

In file included from main.cpp:1:
In file included from /usr/local/Cellar/llvm/13.0.0_2/lib/clang/13.0.0/include/omp.h:18:
/usr/local/opt/llvm/bin/../include/c++/v1/stdlib.h:93:15: fatal error: 'stdlib.h' file not found
#include_next <stdlib.h>

Can anyone help me with next steps? I suppose I should add stdlib somewhere, but I don't have idea how to do it.

Raspberry
  • 337
  • 2
  • 4
  • 16
  • 1. every C compiler should find `stdlib.h` without any help from you. 2. I don't have an M1, but: why are you installing x86 stuff? Is there no native compiler available? If there is, OpenMP should be included in any C/C++/Fortran compiler. – Victor Eijkhout Jan 16 '22 at 16:45
  • 1. That's my question why it is not included. 2. Generally, OpenMp is not supported on M1 Mac – Raspberry Jan 16 '22 at 16:57

0 Answers0