[lammps-users] using lammps as a library

Hello all,

I have successfully compiled lammps as a library under linux x86_64 machine.
But when I tried to compile an example file “c++_driver.cpp” I’ve got lots of error messages like this:

/home/konst/lammps-29Aug10/src/liblmp_linux.a(pair_reax.o): In function _ZN9LAMMPS_NS8PairREAX16write_reax_vlistEv.':* *pair_reax.cpp:(.text+0x2c58): undefined reference to cbkpairs_’
pair_reax.cpp:(.text+0x2c5f): undefined reference to cbkpairs_'* *pair_reax.cpp:(.text+0x2c6a): undefined reference to cbknvlbo_’
pair_reax.cpp:(.text+0x2c83): undefined reference to `cbknvlbo_’

The detailed error log is attached to this e-mail.

How could I fix it?

Thanks.

log.txt (13.5 KB)

Hello all,

I have successfully compiled lammps as a library under linux x86_64 machine.
But when I tried to compile an example file “c++_driver.cpp” I’ve got lots of error messages like this:

/home/konst/lammps-29Aug10/src/liblmp_linux.a(pair_reax.o): In function _ZN9LAMMPS_NS8PairREAX16write_reax_vlistEv.':* *pair_reax.cpp:(.text+0x2c58): undefined reference to cbkpairs_’
pair_reax.cpp:(.text+0x2c5f): undefined reference to cbkpairs_'* *pair_reax.cpp:(.text+0x2c6a): undefined reference to cbknvlbo_’
pair_reax.cpp:(.text+0x2c83): undefined reference to `cbknvlbo_’

How could I fix it?

Thanks.

hi,

there is no need to post the same question multiple times.

you have compiled in reax support, so you will also have
to link with the reax library and all ancillary libraries (e.g. the
fortran compiler runtime).

check out the command line for the build of the regular lammps executable.

cheers,
    axel.

Axel is correct. If you use one of the Makefiles for the driver
code example, then if you built a LAMMPS lib with auxiliary libs
you will certainly need to modify those Makefiles to also link
against those libs, just as if you were building LAMMPS as
a stand-alone code.

Steve