[MPICH] Problems compiling MPICH2 programs on WinXP with gcc
David Ashton
ashton at mcs.anl.gov
Fri Jan 27 17:29:08 CST 2006
You need to put the link options after the compile options. I tried your
example, reproduced the error, and corrected it by moving the -lmpi to the
end of the command:
gcc -L"C:/Program Files/MPICH2/lib" mpi.o -o mpi -lmpi
-David Ashton
-----Original Message-----
From: owner-mpich-discuss at mcs.anl.gov
[mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of Jellyworld
Sent: Thursday, January 26, 2006 9:47 PM
To: mpich-discuss at mcs.anl.gov
Subject: [MPICH] Problems compiling MPICH2 programs on WinXP with gcc
I installed the Win32 version of MPICH2 into C:\Program Files\MPICH2
yesterday, and I tried to compile icpi.c in the /mpich2/examples
directory using gcc using the command
gcc -I"C:/Program Files/MPICH2/include" -c -o mpi.o icpi.c
The compile worked fine, but when I tried to link it using
gcc -L"C:/Program Files/MPICH2/lib" -lmpi mpi.o -o mpi
but I get the following errors
mpi.o(.text+0x6d):mpi.c: undefined reference to `MPI_Init'
mpi.o(.text+0x80):mpi.c: undefined reference to `MPI_Comm_size'
mpi.o(.text+0x93):mpi.c: undefined reference to `MPI_Comm_rank'
mpi.o(.text+0xa8):mpi.c: undefined reference to `MPI_Get_processor_name'
mpi.o(.text+0x11c):mpi.c: undefined reference to `MPI_Wtime'
mpi.o(.text+0x14a):mpi.c: undefined reference to `MPI_Bcast'
mpi.o(.text+0x1eb):mpi.c: undefined reference to `MPI_Reduce'
mpi.o(.text+0x219):mpi.c: undefined reference to `MPI_Wtime'
mpi.o(.text+0x24c):mpi.c: undefined reference to `MPI_Finalize'
collect2: ld returned 1 exit status
make: *** [mpi] Error 1
I'm using gcc 3.4.2 (MINGW) which came with DEV-CPP.
Any help would be greatly appreciated.
More information about the mpich-discuss
mailing list