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相关是被注视掉了的

相关推荐
2501_916008893 小时前
移动安全之 APP 加固,保障移动应用安全的重要手段
安全·macos·ios·小程序·uni-app·iphone·xcode
艾莉丝努力练剑9 小时前
Mac 远程桌面体验:6 个工具的 macOS 适配情况整理
linux·运维·服务器·macos·面试
YH55269841 天前
MacBook Air M4 和 M5 怎么选?
macos
MoSTChillax1 天前
数字人竞品分析(中):核心功能、产品使用与技术能力对比
ide·macos·xcode
码农阿豪2 天前
【金仓数据库征文】Mac开发环境|SpringBoot3 + MyBatisPlus对接KES V9 Docker实战全指南
数据库·macos·docker
赶路人儿2 天前
MacOS 下实现 AI 操控电脑(Computer Use)的思考
人工智能·macos·策略模式
天空'之城2 天前
VMware17.5.0安装macOS13.7.8|Xcode15.0.1+Qt6.5.3开发环境搭建完整教程
macos·虚拟机·vmware tools
00后程序员张2 天前
使用Instruments工具深入分析iOS应用性能与启动时间优化
android·macos·ios·小程序·uni-app·cocoa·iphone
2601_960906722 天前
AI研发加速中式及泛亚洲
人工智能·vscode·macos·sublime text·phpstorm
sg_knight2 天前
Codex CLI 安装全攻略:macOS / Linux / Windows(WSL2)三端实战
linux·windows·macos·openai·ai编程·coding·codex