gpt4 book ai didi

c++ - 使用 make 编译 MPI,出现几个命名空间错误,例如 "error: unknown type name ‘using’?

转载 作者:行者123 更新时间:2023-11-28 01:28:10 27 4
gpt4 key购买 nike

我正在尝试在 Xubuntu 16.04 LTS 上编译 MPI,我非常肯定我已经安装了所有 g++ 和 gcc 包含和库,但我遇到了这个奇怪的困惑...

    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

这是最后的配置输出。

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

最佳答案

因为,您正在尝试编译一个显然是 C 文件而不是 C++ 文件的文件 pshmem_init.c。 make 和编译器都会尝试将以 .c 结尾的文件编译为 C,除非您竭尽全力改变他们的想法。

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

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

关于c++ - 使用 make 编译 MPI,出现几个命名空间错误,例如 "error: unknown type name ‘using’?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52895092/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com