MacOS安装openMP报错【已解决】

error: Target "WLBG" links to: OpenMP::OpenMP_CXX but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing.

最开始是报这个错,我以为是cmakeLists出错了,target_link_libraries里面加了OpenMP::OpenMP_CXX。但是我照着gpt给出的解决方案和网上给的方法一通改,在cmakeLists里面加针对macos的一些指令,都不行。

后面我搜macos怎么安装openMP,运行了 brew install gcc,里面自动安装了libomp

但是又报错

fatal error: 'omp.h' file not found

我以为是openmp还是没装对,又搜各种装openmp的指令,以及设置path啥的,但是不是已经装过了就是装不上。我再一看帖子已经是2017、2018年的了,现在已经没有gcc --without-multilib这种选项了,现在openmp是被包含在libomp里的,而libomp又回被brew在安装gcc的时候装上。

我还尝试了修改编译时的参数,加上-fopenmp和路径。但是我是用的qt,尝试在qt里面加上,路径是brew ls gcc找到的。不行,还是报一样的错。

于是搜索fatal error: 'omp.h' file not found,搜到一个帖子https://stackoverflow.com/questions/72706342/openmp-mac-m1-gcc-and-libomp-not-working

照做之后暂时能跑了。。。🙏

虽然很不优雅但是先这样吧。。。

ps. Cmakelists里面的openmp相关是被注视掉了的

相关推荐
mixboot4 小时前
macOS 安装 Miniconda
macos·miniconda
你好龙卷风!!!4 小时前
mac m4 Homebrew安装MySQL 8.0
数据库·mysql·macos
黄晓魚11 小时前
Pyside MacOS控件样式
macos
Silber 甜12 小时前
MacOS bash&zsh 命令行自动推荐补全工具
开发语言·macos·bash
Johnny Tong14 小时前
macOS 制作dmg磁盘映像安装包
macos·磁盘·安装包·dmg
Tee xm16 小时前
清晰易懂的Trae实现为AI编程从安装到实战开发ToDoList
windows·macos·ai编程
humiaor1 天前
Mac上Github加速方案
macos·github加速·mac上github加速·chrome浏览器插件
星鹿XINGLOO1 天前
畅享Mac桌面版TikTok!
macos·安卓·iphone·mac·web·web app
dongqin501 天前
【Linux】环境搭建 - 使用Mac电脑连接树莓派
linux·服务器·macos
_Johnny_1 天前
macOS 安装 homebrew
macos