openmp mingw墨西哥人对matlab错误

1视图(30天)
俊凯王
俊凯王 2021年6月20日
编辑: 沃尔特·罗伯森 2021年6月22日
我使用代码块和mingw 6.30编译器环境。开始时,我创建了以下OpenMP代码在代码块
没有错误
#包括< iostream >
#包括< omp.h >
#包括< stdio . h >
#包括< mex.h >
使用名称空间性病;
intmain ()
{
int = 100;
#编译指示omp平行lastprivate (A) firstprivate (A)
(int i = 0;我+ +)< 10;
{
= + i;
}
printf (“% d \ n”,);
cout < < omp_get_active_level () < <“\ n”;/ /这函数omp_get_active_level ()在cpp兼容
返回0;
}
代码像这样,我相信mingw6.30 gcc是兼容openmp函数像omp_get_active_level ()
下一个设置,我想改变这段代码为matlab mexfunction,所以代码改变这样的
#包括< iostream >
#包括< omp.h >
#包括< stdio . h >
#包括< mex.h >
使用名称空间性病;
int测试()
{
int = 100;
#编译指示omp平行lastprivate (A) firstprivate (A)
(int i = 0;我+ +)< 10;
{
= + i;
}
printf (“% d \ n”,);
cout < < omp_get_active_level () < <“\ n”;/ /这函数omp_get_active_level ()在cpp兼容
返回0;
}
无效mexFunction (int nlhs mxArray * plhs [], int nrhs, const mxArray * prhs [])
{
测试();
}
在matlab2020b,我选择我的matlab编译器mingw6.30墨西哥人而不是vc++,但是当我编译cpp墨西哥人(我输入 墨西哥人 - v COMPFLAGS = " COMPFLAGS美元 openmp” main.cpp ),matlab这样的警告
这让我困惑,因为在代码块中,纯cpp项目是兼容与omp_get_active_level运行,而在墨西哥人编译器,matlab警告这个函数定义,我删除omp_get_active_level之后,墨西哥人编译器没有错误,为什么?matlab mexfunction支持omp_get万博1manbetx_active_level与否
4评论
俊凯王
俊凯王 2021年6月20日
成功!谢谢

登录置评。

答案(0)

s manbetx 845


释放

R2020b

社区寻宝

找到宝藏在MATLAB中央,发现社区如何帮助你!

开始狩猎!