clang - MSYS2:带有 OpenMP 库的 GCC 可以工作,但 OpenMP 无法正常工作
问题描述
在 MSYS2 终端中使用 clang 编译器编译代码时出现以下错误。
在 MSYS2 环境中,它同样适用于带有 OpenMP 的 GCC。
gcc main.c -o main -fopenmp ---> 工作
clang main.c -o main -fopenmp ---> 不工作我遇到以下错误
谁能让我知道这里出了什么问题?
$ clang main.c -o main -fopenmp C:\msys64\mingw64\bin\ld: C:\msys64\tmp\main-f23226.o:main.c:(.text+0x10): undefined reference to omp_get_max_threads'
C:\msys64\mingw64\bin\ld: C:\msys64\tmp\main-f23226.o:main.c:(.text+0x28): undefined reference to
omp_set_dynamic' C:\msys64\mingw64\bin\ld: C:\msys64\tmp\main-f23226.o:main.c:(.text+0x2d): undefined reference to omp_get_max_threads'
C:\msys64\mingw64\bin\ld: C:\msys64\tmp\main-f23226.o:main.c:(.text+0x34): undefined reference to
omp_set_num_threads' C:\msys64\mingw64\bin\ld : C:\msys64\tmp\main-f23226.o:main.c:(.text+0x49): 未定义引用__kmpc_fork_call'
C:\msys64\mingw64\bin\ld: C:\msys64\tmp\main-f23226.o:main.c:(.text+0xeb): undefined reference to
__kmpc_for_static_init_4' C:\msys64\mingw64\bin\ld: C:\msys64\tmp\main- f23226.o:main.c:(.text+0x13d): 未定义对omp_get_thread_num'
C:\msys64\mingw64\bin\ld: C:\msys64\tmp\main-f23226.o:main.c:(.text+0x175): undefined reference to
__kmpc_for_static_fini' 的引用
解决方案
推荐阅读
- node.js - 应用程序未从 mongodb 发送或接收数据
- laravel - 无法解决依赖关系 - Laravel
- php - TYPO3 错误:未捕获的 TYPO3 异常:类 'TYPO3\CMS\Core\Core\Environment?
- bash - 如何将循环通过管道连接到一个 socat 连接
- python - 尝试使用 tensorflow 自定义回调获取中间层预测时出现“层未连接,没有输入返回”错误
- angular - Angular Service Worker 在环境中使用 Promise 注册
- html - 当您放大页面和下面详述的另一个问题时,我的导航栏会重叠
- javascript - 如何获取 vuejs 静态资产 url 以在生产中解析
- python - 如何合并来自 2 个不同 csv 的时间序列数据
- python - 如何在 PyCharm 中导入外部库?