首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用make编译MPI,几个名称空间错误,例如"error: using name‘type“?

用make编译MPI,几个名称空间错误,例如"error: using name‘type“?
EN

Stack Overflow用户
提问于 2018-10-19 15:03:08
回答 1查看 840关注 0票数 0

我正试图在Xubuntu16.04LTS上编译MPI,我非常肯定,我已经安装了我所有的g++和gcc包含和库,但是我得到了这个奇怪的混乱.

代码语言:javascript
复制
    make[3]: Entering directory '/media/verthex/32gig/openmpi-3.1.2/oshmem/shmem/c/profile'
  LN_S     pshmem_init.c
  CC       pshmem_init.lo
In file included from ../../../../oshmem/include/shmem.h:26:0,
                 from ../../../../oshmem/include/oshmem/constants.h:15,
                 from pshmem_init.c:22:
/usr/local/include/complex.h:10:1: error: unknown type name ‘using’
 using namespace std;
 ^
/usr/local/include/complex.h:10:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘std’
 using namespace std;
                 ^
/usr/local/include/complex.h:13:17: fatal error: cmath: No such file or directory
compilation terminated.
Makefile:1950: recipe for target 'pshmem_init.lo' failed
make[3]: *** [pshmem_init.lo] Error 1
make[3]: Leaving directory '/media/verthex/32gig/openmpi-3.1.2/oshmem/shmem/c/profile'
Makefile:2012: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/media/verthex/32gig/openmpi-3.1.2/oshmem/shmem/c'
Makefile:2578: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/media/verthex/32gig/openmpi-3.1.2/oshmem'
Makefile:1897: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

这是最后的配置输出。

代码语言:javascript
复制
Open MPI configuration:
-----------------------
Version: 3.1.2
Build MPI C bindings: yes
Build MPI C++ bindings (deprecated): no
Build MPI Fortran bindings: no
MPI Build Java bindings (experimental): no
Build Open SHMEM support: yes
Debug build: no
Platform file: (none)

Miscellaneous
-----------------------
CUDA support: no
PMIx support: internal

Transports
-----------------------
Cisco usNIC: no
Cray uGNI (Gemini/Aries): no
Intel Omnipath (PSM2): no
Intel SCIF: no
Intel TrueScale (PSM): no
Mellanox MXM: no
Open UCX: no
OpenFabrics Libfabric: no
OpenFabrics Verbs: yes
Portals4: no
Shared memory/copy in+copy out: yes
Shared memory/Linux CMA: yes
Shared memory/Linux KNEM: no
Shared memory/XPMEM: no
TCP: yes

Resource Managers
-----------------------
Cray Alps: no
Grid Engine: no
LSF: no
Moab: no
Slurm: yes
ssh/rsh: yes
Torque: no
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-10-19 18:13:18

因为,您正在尝试编译一个文件pshmem_init.c,它显然是一个C文件,而不是C++文件。make和编译器都将尝试编译以.c结尾为C的文件,除非您花费了非常长的时间来改变他们的想法。

在我看来,C文件pshmem_init.c包含了头部complex.h,意思是访问在/usr/include/complex.h中找到的标准C头文件,但是您已经以相同的名称(complex.h)向/usr/local/include中添加了一个C++头文件,并且要求编译器首先在那里查找(它将始终在默认的系统目录中查找最后一个)。

在这段代码编译之前,您必须解决这个问题。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52895092

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档