MPI编译C++程序出现#error "SEEK_SET is #defined but must not be for the C++ binding of MPI" 的解决方法

来源:互联网 发布:淘宝饰品包邮怎么挣钱 编辑:程序博客网 时间:2024/06/05 14:26

MPI的mpicc和mpicxx命令编译C++程序时,可能会遇到如下三种错误信息:

#error "SEEK_SET is #defined but must not be for the C++ binding of MPI"

#error "SEEK_CUR is #defined but must not be for the C++ binding of MPI"

#error "SEEK_END is #defined but must not be for the C++ binding of MPI"

 

原因:

Is the result of a name conflict between stdio.h and the MPI C++ binding.

解决方法

Users should place the mpi include before the stdio.h and iostream includes.

 

简单的就,就是头文件包含的顺序问题,可能是把#include <iostream>放在了#include "mpi.h"的前面,才出现了如此莫名其妙的错误……

 

 

把#include "mpi.h"放在最前面就OK了。

 

 

参考:http://www.nics.tennessee.edu/node/295

原创粉丝点击