在 Windows 上使用 MinGW 编译 C++ 时找不到 omp.h

Posted

技术标签:

【中文标题】在 Windows 上使用 MinGW 编译 C++ 时找不到 omp.h【英文标题】:omp.h can't be found when compile C++ with MinGW on windows 【发布时间】:2016-06-25 14:14:52 【问题描述】:

我正在编写 C++ 代码并在 windows 上使用 g++、MinGM 进行编译,但错误显示:

错误:omp.h:没有这样的文件或目录 #包括 ^ 编译终止。

这是我安装 MinGW 时的安装列表:

在MinGW的安装文件中找不到omp.h文件:

【问题讨论】:

确保使用<omp.h>(尖括号) 是的。错误:omp.h:没有这样的文件或目录#include ^ 编译终止。 你有D:\MinGW\lib\gcc\mingw32\4.9.3\include\omp.h 吗? 我在 D:\MinGW 中找不到 opm.h 文件,当然在 D:\MinGW\lib\gcc\mingw32\4.9.3\include 中也找不到 【参考方案1】:

基本上,public sources 推荐安装TDM-GCC,因为它有默认的 OpenMP 安装选择:

http://tdm-gcc.tdragon.net/download

另外,使用标准 MinGW,从您的 MinGW 控制台尝试:

mingw-get install mingw32-pthreads-w32
mingw-get install mingw32-pthreads-w32-dev

【讨论】:

以上是关于在 Windows 上使用 MinGW 编译 C++ 时找不到 omp.h的主要内容,如果未能解决你的问题,请参考以下文章