Dear Lammps group,
I am working on a project that aims to call LAMMPS as a library from another code. Since I am pretty new at this I tried working though examples/COUPLE/simple (Am using version released on 7th August 2019). Now I have run into few problems (I have tried to go through some posts regarding this matter but was of little help - my naivitte on this matter may be issue :)). These are essentially compilation issues
Below are the documentation of the issues I have faced:
when I type g++ -I…/…/…/src -I…/…/…/src/STUBS -c simple.cpp
I get simple.o file
After that using the command g++ simple.o -L…/…/…/src/ -llammps -o simpleCC
gives
Undefined symbols for architecture x86_64:
“_MPI_Abort”, referenced from:
_main in simple.o
“_MPI_Barrier”, referenced from:
_main in simple.o
“_MPI_Bcast”, referenced from:
_main in simple.o
“_MPI_Comm_free”, referenced from:
_main in simple.o
“_MPI_Comm_rank”, referenced from:
_main in simple.o
“_MPI_Comm_size”, referenced from:
_main in simple.o
“_MPI_Comm_split”, referenced from:
_main in simple.o
“_MPI_Finalize”, referenced from:
_main in simple.o
“_MPI_Init”, referenced from:
_main in simple.o
“LAMMPS_NS::LAMMPS::LAMMPS(int, char**, int)”, referenced from:
_main in simple.o
ld: symbol(s) not found for architecture x86_64
I have even tried g++ simple.o -L…/…/…/src/ -llammps -lfftw3 -o simpleCC
and got
Undefined symbols for architecture x86_64:
“_MPI_Abort”, referenced from:
_main in simple.o
“_MPI_Barrier”, referenced from:
_main in simple.o
“_MPI_Bcast”, referenced from:
_main in simple.o
“_MPI_Comm_free”, referenced from:
_main in simple.o
“_MPI_Comm_rank”, referenced from:
_main in simple.o
“_MPI_Comm_size”, referenced from:
_main in simple.o
“_MPI_Comm_split”, referenced from:
_main in simple.o
“_MPI_Finalize”, referenced from:
_main in simple.o
“_MPI_Init”, referenced from:
_main in simple.o
“LAMMPS_NS::LAMMPS::LAMMPS(int, char**, int)”, referenced from:
_main in simple.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can someone give me some guidelines or direct me to an appropropriate post where (which I may have missed)
Thank you so much for your time and patience.
Deep
[Sorry for the re-post]