title: Calling a c++ function on Rstudio on a MAC and getting (clang: error: unsupported option '-fopenmp')
body: <p>I know how to code but I really do not know my way around a computer.</p>
  <p>I have a program that I have to run for my master thesis. It is a code with multiple collabs and runs perfectly on Linux. However, it is a very complex simulational code and therefore it takes time to run for multiple parameters. I've been using my Linux at the university to run it but would like to run some of it on my personal computer (MAC OS). It works by using the R language to call upon c++ functions as follows (being filename a code on c++).</p>
  <p>On a Rstudio script:</p>
  <pre><code>Sys.setenv(&quot;PKG_CPPFLAGS&quot; = &quot;-fopenmp -DPARALLEL&quot;) 
  system(&quot;rm filename.so&quot;) 
  system(&quot;rm filename.o&quot;) 
  system (&quot;R CMD SHLIB filename.cpp&quot;) 
  dyn.load(&quot;filename.so&quot;)
  </code></pre>
  <p>After <code>system (&quot;R CMD SHLIB filename.cpp&quot;)</code> I get error:</p>
  <blockquote>
  <p>clang: error: unsupported option '-fopenmp'
  make: *** [filename.o] Error 1</p>
  </blockquote>
  <p>I've researched on the subject and found this
  <a href="https://stackoverflow.com/questions/43555410/enable-openmp-support-in-clang-in-mac-os-x-sierra-mojave">Enable OpenMP support in clang in Mac OS X (sierra &amp; Mojave)</a></p>
  <p>I've Installed LLVM, yet I do not know how to use it in this case.</p>
  <p>How do I use it in this case?
  Thank you in advance.</p>