When I link my MPI C program, I get the following error: undefined reference to MPI_recv
.
What should i do to solve this error?
它是MPI_Recv
,不是MPI_recv
。
You need to link to the MPI library that provides the MPI_recv()
function. For example, with gcc
, you would add an option like -lmpi
to your compile line.
MPI implementations usually provide a compilation utility scripts that basically sets up the correct compilation & linking environment, libraries and calls gcc (eg) with the correct command line.
Try this:
mpicc my_prog.c
Hope this helps.
A.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.