运行OpenMP的Mac,"clang:错误:不支持的选项'-fopenmp'"; [英] Mac running OpenMP, "clang: error: unsupported option '-fopenmp'"

查看:347
本文介绍了运行OpenMP的Mac,"clang:错误:不支持的选项'-fopenmp'";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是OpenMP的新手,我的教授为我们提供了一个项目.文件夹中只有三个文件:C ++源代码a0.cpp,标头a0.h和Makefile.当我想在终端中运行代码时,它说:

I am new to OpenMP, and my professor gives us a project to do. There are only three files in the folder: a C++ source code a0.cpp, a header a0.h, and a Makefile. When I want to run the code in my terminal, it says:

clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
make: *** [a0] Error 1

我正在使用Macbook,但不知道如何解决.你能帮助我吗?谢谢.

I am using a Macbook, and I do not know how to fix this. Can you help me? Thanks.

推荐答案

使用自制软件安装libomp后,使用:

brew install libomp

我能够使用以下命令编译一个OpenMP程序:

I was able to compile an OpenMP program with this:

clang -Xpreprocessor -fopenmp -I/usr/local/include -L/usr/local/lib -lomp  main.c -o main

如果您使用的是C ++,则可能需要:

If you are using C++, you'd likely want:

clang++ -Xpreprocessor -fopenmp -I/usr/local/include -L/usr/local/lib -lomp  main.cpp -o main

这篇关于运行OpenMP的Mac,"clang:错误:不支持的选项'-fopenmp'";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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