本文介绍了clang-omp在Xcode下El Capitan的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢在C ++项目中使用openmp,使用Xcode作为IDE。不幸的是,Apple的Clang编译器不支持openmp( ),因此我安装了。我完全按照网站上的指示使用它在Xcode中,但我得到错误消息 c / c> 在项目的构建阶段下添加 /usr/local/lib/libiomp5.dylib 到链接二进制

  • 通过创建符号链接sudo ln -s / usr / local / bin / clang-omp ++ / usr / local / bin / clang ++ - omp 使用终端

  • 使用 #include< libiomp / omp.h> 才能在项目中使用openmp

    1. Install clang-omp using homebrew: brew install clang-omp
    2. Create a new Xcode project
    3. Add a new user-defined setting CC with the value /usr/local/bin/clang-omp under the project's build settings
    4. Add -fopenmp to Other C Flags under the project's build settings
    5. Add /usr/local/include to Header Search Paths under the project's build settings
    6. Add /usr/local/lib to Library Search Paths under the project's build settings
    7. Set Enable Modules (C and Objective-C) to No under the project's build settings
    8. Add /usr/local/lib/libiomp5.dylib to Link Binary With Libraries under the project's build phases
    9. Make a symbolic link via sudo ln -s /usr/local/bin/clang-omp++ /usr/local/bin/clang++-omp using the terminal
    10. Use #include <libiomp/omp.h> to be able to use openmp in your project

    这篇关于clang-omp在Xcode下El Capitan的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    09-12 20:39