Dear every one,

I had one post in March, which is on the following link:
http://www.lam-mpi.org/MailArchives/lam/2006/03/12120.php

It was about compiling code which mixs c++ and fortran. Brian solved my problem, he told me to add -llammpi++ in the compile command and the compiling was successful. But now when I compile the same code in another cluster, the compiling failed and I got similar error message as that (not using library lammpi++) of in former cluster. But now I linked the library lammpi++ when compiled in new cluaster.

The difference between the LAM/MPI in two clusters are:
(1) in the former cluster (compiling successful), the  LAM/MPI  header file is in the directory /usr/lib/lam/include, so I use the following command
g++ -c gibbsreg.cpp -I/usr/lib/lam/include
mpif77 -llammpi++ -lstdc++ gibbsreg.o -lblas -llapack -lg2c -lm

When I use "locate lammpi++", I got
/usr/lib/lam/lib/liblammpi++.a
/usr/lib/lam/lib/liblammpi++.so


(2)in the new cluster, the LAM/MPI  header file is in the directory /usr/include, so I use the following command
g++ -c gibbsreg.cpp -I/usr/include
mpif77 -llammpi++ -lstdc++ gibbsreg.o -lblas -llapack -lg2c -lm

When I use "locate lammpi++", I got
/usr/lib64/liblammpi++.a
/usr/lib64/liblammpi++.la


When use above compile command, in new cluster, I got the following error message:
gibbsreg.o(.gnu.linkonce.r._ZTVN3MPI2OpE+0x20): undefined reference to `MPI::Op ::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool)'
gibbsreg.o(.gnu.linkonce.r._ZTVN3MPI2OpE+0x28): undefined reference to `MPI::Op ::Free()'
gibbsreg.o(.gnu.linkonce.t._ZN4PMPI8CartcommC1ERKP5_comm+0x2a): In function `PM PI::Cartcomm::Cartcomm(_comm* const&)':
: undefined reference to `MPI::Is_initialized()'
gibbsreg.o(.gnu.linkonce.t._ZN4PMPI9GraphcommC1ERKP5_comm+0x2a): In function `P MPI::Graphcomm::Graphcomm(_comm* const&)':
: undefined reference to `MPI::Is_initialized()'
gibbsreg.o(.gnu.linkonce.t._ZN4PMPI9IntracommC1ERKP5_comm+0x2a): In function `P MPI::Intracomm::Intracomm(_comm* const&)':
: undefined reference to `MPI::Is_initialized()'
gibbsreg.o(.gnu.linkonce.t._ZNK4PMPI9Intracomm4ScanEPKvPviRKNS_8DatatypeERKNS_2 OpE+0x27): In function `PMPI::Intracomm::Scan(void const*, void*, int, PMPI::Da tatype const&, PMPI::Op const&) const':
: undefined reference to `PMPI::Intracomm::current_op'
gibbsreg.o(.gnu.linkonce.t._ZNK4PMPI9Intracomm4ScanEPKvPviRKNS_8DatatypeERKNS_2 OpE+0x64): In function `PMPI::Intracomm::Scan(void const*, void*, int, PMPI::Da tatype const&, PMPI::Op const&) const':
: undefined reference to `PMPI::Intracomm::current_op'
gibbsreg.o(.gnu.linkonce.t._ZNK4PMPI9Intracomm14Reduce_scatterEPKvPvPiRKNS_8Dat atypeERKNS_2OpE+0x28): In function `PMPI::Intracomm::Reduce_scatter(void const* , void*, int*, PMPI::Datatype const&, PMPI::Op const&) const':
: undefined reference to `PMPI::Intracomm::current_op'
gibbsreg.o(.gnu.linkonce.t._ZNK4PMPI9Intracomm14Reduce_scatterEPKvPvPiRKNS_8Dat atypeERKNS_2OpE+0x66): In function `PMPI::Intracomm::Reduce_scatter(void const* , void*, int*, PMPI::Datatype const&, PMPI::Op const&) const':
: undefined reference to `PMPI::Intracomm::current_op'
gibbsreg.o(.gnu.linkonce.t._ZNK4PMPI9Intracomm9AllreduceEPKvPviRKNS_8DatatypeER KNS_2OpE+0x27): In function `PMPI::Intracomm::Allreduce(void const*, void*, int , PMPI::Datatype const&, PMPI::Op const&) const':
: undefined reference to `PMPI::Intracomm::current_op'
gibbsreg.o(.gnu.linkonce.t._ZNK4PMPI9Intracomm9AllreduceEPKvPviRKNS_8DatatypeER KNS_2OpE+0x64): more undefined references to `PMPI::Intracomm::current_op' foll ow
gibbsreg.o(.gnu.linkonce.t._ZNK4PMPI4Comm8Set_attrEiPKv+0x7c): In function `PMP I::Comm::Set_attr(int, void const*) const':
: undefined reference to `PMPI::Comm::mpi_comm_map'
gibbsreg.o(.gnu.linkonce.t._ZNK4PMPI4Comm8Set_attrEiPKv+0xb7): In function `PMP I::Comm::Set_attr(int, void const*) const':
: undefined reference to `PMPI::Comm::mpi_comm_map'
gibbsreg.o(.gnu.linkonce.t._ZN4PMPI4Comm14Set_errhandlerERKNS_10ErrhandlerE+0x2 8): In function `PMPI::Comm::Set_errhandler(PMPI::Errhandler const&)':
: undefined reference to `PMPI::Comm::mpi_err_map'
gibbsreg.o(.gnu.linkonce.t._ZN4PMPI4Comm4FreeEv+0x2d): In function `PMPI::Comm: :Free()':
: undefined reference to `PMPI::Comm::mpi_comm_map'
gibbsreg.o(.gnu.linkonce.t._ZN4PMPI4Comm4FreeEv+0x41): In function `PMPI::Comm: :Free()':
: undefined reference to `PMPI::Comm::mpi_comm_map'
gibbsreg.o(.gnu.linkonce.t._ZN4PMPI4Comm4FreeEv+0x57): In function `PMPI::Comm: :Free()':
: undefined reference to `PMPI::Comm::mpi_comm_map'
gibbsreg.o(.gnu.linkonce.t._ZN4PMPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb+0x20): I n function `PMPI::Op::Init(void (*)(void const*, void*, int, PMPI::Datatype con st&), bool)':
: undefined reference to `op_intercept'
collect2: ld returned 1 exit status
mpif77: No such file or directory

Any ideas about how to solve this problem? Many thanks!

Best regards,
Guiyuan