我已经在我的 linux 机器(CentOS 6.4)上安装了 MPICH(ver 3.0.4)来进行一些并行计算。我尝试编译“pmandel.c”(以 MPICH 安装包为例)以使用以下命令测试我的 MPICH 安装:
mpicc pmandel.c -o pmandel.out
但它返回这些错误:
pmandel.c: In function ‘main’:
pmandel.c:279: warning: passing argument 2 of ‘bind’ from incompatible pointer type
/usr/include/sys/socket.h:115: note: expected ‘const struct sockaddr *’ but argument is of type ‘struct sockaddr_in *’
pmandel.c:282: warning: passing argument 2 of ‘bind’ from incompatible pointer type
/usr/include/sys/socket.h:115: note: expected ‘const struct sockaddr *’ but argument is of type ‘struct sockaddr_in *’
pmandel.c:296: warning: passing argument 2 of ‘getsockname’ from incompatible pointer type
/usr/include/sys/socket.h:119: note: expected ‘struct sockaddr * __restrict__’ but argument is of type ‘struct sockaddr_in *’
/tmp/cclNv8nA.o: In function `exponential_complex':
pmandel.c:(.text+0x2fc2): undefined reference to `exp'
pmandel.c:(.text+0x2fd1): undefined reference to `cos'
pmandel.c:(.text+0x2fe5): undefined reference to `sin'
/tmp/cclNv8nA.o: In function `absolute_complex':
pmandel.c:(.text+0x3330): undefined reference to `sqrt'
collect2: ld returned 1 exit status
并且没有输出。我也试过“mpic++”、“mpiCC”、mpicxx”……但都无济于事。
我应该怎么做才能纠正这个?