【发布时间】:2022-01-18 04:58:15
【问题描述】:
当我尝试使用 mpicc "srcfile" -o "exfile" 编译 MPI 文件时,出现以下错误:
sump.c:3:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error generated.
但是当我使用gcc 运行普通系列代码时,我没有收到该错误。
我相信这是因为我使用以下命令错误地更改了一些路径:
export PATH="$(brew --prefix llvm)/bin:$PATH";
export COMPILER=/usr/local/opt/llvm/bin/clang++
export CFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include"
export CXXFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include"
export LDFLAGS="${LDFLAGS} -mlinker-version=450"
我该如何解决这个问题?
【问题讨论】:
-
stdio.h是否安装正确?它在哪里?在/usr/include?你能做一个用clang++和mpicc编译的“hello world”程序吗?请注意,clang++是 C++ 编译器,而不是 C 编译器。另外,我会将-I与目录(例如)-I dir-->-Idir[可能只是...] 邻接。如果stdio.h在/usr/local/include中,您可能需要:mpicc -I/usr/local/include "srcfile" -o "exfile" -
我在 /usr/local/include 中找不到 stdio.h,我可以使用 gcc 串行编译“Hello World”程序,但是当我使用 mpicc 编译时出现此问题,此问题在我执行后出现提到的配置。
-
mpicc是C编译器的包装器。你确定它会调用你期望的那个吗?如果你使用 Open MPI,你可以mpicc --showme srcfile.c来查看调用了哪个命令行。 -
知道
stdio.h在在哪里会有所帮助。在/usr/include[因为它不在/usr/local/include]?find / -name stdio.h产生什么?您可以在strace gcc ...的等效项下运行编译器,并查看gcc在哪里找到文件(与mpicc在哪里 not 找到文件)。另外,ifCOMPILER设置为clang++而不是clang,这 [不知何故] 会影响制作中的内容吗? (例如,make 告诉mpicc使用clang++作为其底层 C 编译器?) -
嘿,这个错误你解决了吗?我有同样的问题。
标签: c parallel-processing mpi