【并行计算】error C2555: 'MPI::Intercomm::Clone' : overriding virtual function differs from 'MPI::C
【转】error C2555: 'MPI::Intercomm::Clone' : overriding virtual function differs from 'MPI::C
重载错误:
d:\program files\mpich2\include\mpicxx.h(1536) : error C2555: 'MPI::Intercomm::Clone' : overriding virtual function differs from 'MPI::Comm::Clone' only by return type or calling convention
d:\program files\mpich2\include\mpicxx.h(1107) : see declaration of 'Comm'
解决方法:
在细看错误,都是一些函数重载错误,部是mpicxx.h文件导致的错误,于是想是否MPI_Init等函数与此文件有关。通过搜索包含文字,发现MPI_Init等函数只在mpi.h中定义,于是想办法不包含mpicxx.h文件以避开问题。在mpi.h中发现代码:
#if !defined(MPICH_SKIP_MPICXX)
#include "mpicxx.h"
#endif
在程序中定义宏MPICH_SKIP_MPICXX,然后重新编译程序(注意在包含mpi.h前定义)。果然避开了mpicxx.h文件,OK!