How to include omp.h in OS X?

前端 未结 5 625
一个人的身影
一个人的身影 2020-11-30 11:04

I\'m new in C and have some problems compiling my code in OS X.

I code Java a lot both in Eclipse and use terminal to compile my code. However now I\'m learning open

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 11:25

    This command can help you

    brew install libomp

    brew info libomp
    libomp: stable 6.0.1 (bottled)
    LLVM's OpenMP runtime library
    https://openmp.llvm.org/
    /usr/local/Cellar/libomp/6.0.1 (12 files, 1.2MB) *
      Poured from bottle on 2018-11-20 at 16:12:22
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/libomp.rb
    ==> Dependencies
    Build: cmake ✘
    ==> Requirements
    Required: macOS >= 10.10 ✔
    ==> Caveats
    On Apple Clang, you need to add several options to use OpenMP's front end
    instead of the standard driver option. This usually looks like
      -Xpreprocessor -fopenmp -lomp
    
    You might need to make sure the lib and include directories are discoverable
    if /usr/local is not searched:
    
      -L/usr/local/opt/libomp/lib -I/usr/local/opt/libomp/include
    
    For CMake, the following flags will cause the OpenMP::OpenMP_CXX target to
    be set up correctly:
      -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" -DOpenMP_CXX_LIB_NAMES="omp" -DOpenMP_omp_LIBRARY=/usr/local/opt/libomp/lib/libomp.dylib
    

提交回复
热议问题