Openmpi编译错误:mpicxx.h“数字常量之前的预期标识符”

时间:2012-05-23 08:48:41

标签: openmpi

我正在尝试使用openmpi编译程序,我的代码没有给出任何错误,但是其中一个mpi标题确实存在:

/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/mpicxx.h:168: error: expected identifier before numeric constant
/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/mpicxx.h:168: error: expected unqualified id before numeric constant

标题中的相关代码行只是:

namespace MPI {

我正在使用mpiCC编译器。难道我做错了什么?或者这是openmpi中的一个错误?

提前致谢。

1 个答案:

答案 0 :(得分:1)

虽然我无法重现您遇到的问题,但可以在mpi.h中找到以下评论,其中包含mpicxx.h

/*                                                                             
 * Conditional MPI 2 C++ bindings support.  Include if:
 *   - The user does not explicitly request us to skip it (when a C++ compiler
 *       is used to compile C code).
 *   - We want C++ bindings support
 *   - We are not building OMPI itself
 *   - We are using a C++ compiler
 */
#if !defined(OMPI_SKIP_MPICXX) && OMPI_WANT_CXX_BINDINGS && !OMPI_BUILDING
#if defined(__cplusplus) || defined(c_plusplus) 
#include "openmpi/ompi/mpi/cxx/mpicxx.h"
#endif
#endif

如果您没有使用已弃用的C ++绑定,那么可能的解决方法是添加

-DOMPI_SKIP_MPICXX

CXXFLAGS。希望这可能有所帮助。

相关问题