On Thu, 3 Jul 2003, William Boatin wrote:
> [snipped]
> HOWEVER, when i try and run gcc as similarly to what is shown above:
>
> gcc -lpmpi -llamf77mpi -lmpi -llam -lutil -o n mpicode.c
>
> shown above, i get errors like :
>
> /tmp/ccPQeQ3l.o(.text+0x19): undefined reference to `MPI_Init'
>
> and more like that. running 'mpicc -o n mpicode.c' works just fine. what
> gives?
The ordering here is important. Notice what mpicc does when you put in
source files (7.0 output shown here; word wrapped for e-mail):
-----
$ mpicc foo.c -o foo -showme
gcc -I/home/jsquyres/local/include -pthread foo.c -o foo \
-L/home/jsquyres/local/lib -lmpi -llam -lutil -pthread
-----
Note that the .c file must come before the libraries. This is because of
the left-to-right ordering of unix linker semantics.
--
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/
|