在VC++6.0中编译MPI程序,而头文件mpicxx.h里函数出错,请问为什么?

snihcyb 2009-12-22 09:16:03
MPI程序在VC++6.0 下编译,一编译就出现许多错误,都是在文件mpicxx.h里的,如:e:\program files\microsoft visual studio\vc98\include\mpicxx.h(1385) : error C2555: 'MPI::Nullcomm::Clone' : overriding virtual function differs from 'MPI::Comm::Clone' only by return type or calling convention
挑了一个mpicxx.h中报错的地方,如下:
// If the compiler does not support variable return types, return a
// reference to Comm. The user must then cast this to the correct type
// (Standard-conforming C++ compilers support variable return types)
#ifdef HAVE_NO_VARIABLE_RETURN_TYPE_SUPPORT
virtual Comm & Clone(void) const {
MPI_Comm ncomm;
MPI_Comm_dup( (MPI_Comm)the_real_comm, &ncomm);
Comm *clone = new Graphcomm(ncomm);
return *clone;
};
#else
virtual Graphcomm & Clone(void) const {
MPI_Comm ncomm;
MPI_Comm_dup( (MPI_Comm)the_real_comm, &ncomm);
Graphcomm *clone = new Graphcomm(ncomm);
return *clone;
};
#endif
};
请问是不是我的编译器不支持?
...全文
448 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
huyonghuyong 2010-05-30
  • 打赏
  • 举报
回复
感谢咯,得救了……
snihcyb 2009-12-23
  • 打赏
  • 举报
回复
谢谢2楼的回复!
snihcyb 2009-12-23
  • 打赏
  • 举报
回复
自己找到答案了,在#include "mpi.h"前加入一句 #define MPICH_SKIP_MPICXX就可以了!
macrojj 2009-12-22
  • 打赏
  • 举报
回复
// If the compiler does not support variable return types, return a
// reference to Comm. The user must then cast this to the correct type

这都告诉你了

不要返回引用。

把&去掉试试

3,881

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧