现在的位置: 首页 > 综合 > 正文

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

2013年08月23日 ⁄ 综合 ⁄ 共 500字 ⁄ 字号 评论关闭

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

抱歉!评论已关闭.