clang-omp在Xcode下El Capitan [英] clang-omp in Xcode under El Capitan

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

问题描述

我喜欢在C ++项目中使用openmp,使用Xcode作为IDE。不幸的是,Apple的Clang编译器不支持openmp(请参见此处 ),因此我安装了 clang-omp 。我完全按照网站上的指示使用它在Xcode中,但我得到错误消息不能exec'/ usr / local / bin / clang ++ - omp'(没有这样的文件或目录) 。我试图编译在他们的网站通过终端给出的简单的例子,当我通过 clang-omp ++ -fopenmp file.cpp 编译它时工作。对我来说,Xcode应该搜索 / usr / local / bin / clang-omp ++ (与 / usr / local / bin / clang ++ - omp )。按照注释建议的符号链接后,我得到另一个错误消息:库未找到-liomp5 。如何解决这个问题?

I like to use openmp in a c++ project using Xcode as IDE. Unfortunately, Apple's Clang compiler does not support openmp (see here), so I installed clang-omp. I exactly followed the instructions given on that website to use it within Xcode, but I get the error message can't exec '/usr/local/bin/clang++-omp' (No such file or directory). I tried to compile the simple example given on their website via terminal and I got it to work when I compile it via clang-omp++ -fopenmp file.cpp. For me it looks like Xcode should search for /usr/local/bin/clang-omp++ (which exists in contrast to /usr/local/bin/clang++-omp). After making a symlink as suggested in the comments I get another error message: library not found for -liomp5. How can I fix this?

推荐答案

如果任何人试图让Xcode下的clang-omp工作, (遵循官方说明):

In case anyone else is trying to get clang-omp under Xcode to work, the correct way is (following the official instructions):


  1. 使用homebrew安装clang-omp: brew install clang-omp

  2. 创建一个新的Xcode项目

  3. 在项目的构建设置下添加值为 / usr / local / bin / clang-omp 的新用户定义设置CC

  4. 在项目构建设置下将 -fopenmp 添加到Other C Flags

  5. 添加<$ c $ / usr / local / lib code>到项目构建设置下的库搜索路径

  6. 将启用模块(C和Objective-C)设置为 c / c> 在项目的构建阶段下添加 /usr/local/lib/libiomp5.dylib 到链接二进制

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

  8. 使用 #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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆