gcc - 对 `omp_get_max_threads_' 的 undefined reference

标签 gcc openmp gfortran

我在尝试编译项目时遇到以下错误: (fortran,使用 gfortran)

undefined reference to `omp_get_max_threads_'

undefined reference to `omp_get_thread_num_'

问题是,我的 GCC 版本是 4.4.3,它应该支持 OpenMP。

最佳答案

使用gcc,您需要使用-fopenmp进行编译和链接以启用OpenMP。其他编译器有不同的选项;对于 intel,它是 -openmp,对于 pgi,它是 -mp,等等。

关于gcc - 对 `omp_get_max_threads_' 的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9685377/

相关文章:

c++ - 试图理解 GCC-XML 输出变量的含义

loops - Fortran 2018+ 中过时的 DO 循环

编译因#include "..."而失败,但因#include <...> 而失败

gcc - GCC 的 '-pg' 标志如何与分析器相关?

c++ - gcc 4.7 的可选和变体

fortran - 无法在派生类型中打印可分配的分配状态

iphone - iPhone 中的 Fortran 编辑器

c++ - 使用 Xcode 9.0 with clang 时出现编译错误(生成多个输出文件时不能指定 -o)

c - 与 SSE 的并行前缀(累积)总和

c++ - 使用 openMP v. 2.0 并行化过滤器迭代器