[lammps-users] how to compiler win version of lmp with meam

Dear lmp-user.

     I'm trying to compiler the lmp of windows version with meam.
     Basiclly, the compiler is fine.
     But when linking to a execuable file, I get the error message as follows

  xilink6: executing 'C:\PROGRA~1\MICROS~2\VC98\Bin\link.exe'
pair_meam.obj : error LNK2001: unresolved external symbol _meam_cleanup_
pair_meam.obj : error LNK2001: unresolved external symbol _meam_dens_init_
pair_meam.obj : error LNK2001: unresolved external symbol _meam_dens_final_
pair_meam.obj : error LNK2001: unresolved external symbol _meam_force_
pair_meam.obj : error LNK2001: unresolved external symbol _meam_setup_done_
pair_meam.obj : error LNK2001: unresolved external symbol _meam_setup_global_
pair_meam.obj : error LNK2001: unresolved external symbol _meam_setup_param_
Debug/Lammps.exe : fatal error LNK1120: 7 unresolved externals
Error executing xilink6.exe.

    what should i do now?
    thanks.

Dear lmp-user.

I'm trying to compiler the lmp of windows version with meam\.
Basiclly, the compiler is fine\.
But when linking to a execuable file, I get the error message as follows

xilink6: executing 'C:\PROGRA~1\MICROS~2\VC98\Bin\link.exe'
pair_meam.obj : error LNK2001: unresolved external symbol _meam_cleanup_
pair_meam.obj : error LNK2001: unresolved external symbol _meam_dens_init_
pair_meam.obj : error LNK2001: unresolved external symbol _meam_dens_final_
pair_meam.obj : error LNK2001: unresolved external symbol _meam_force_
pair_meam.obj : error LNK2001: unresolved external symbol _meam_setup_done_
pair_meam.obj : error LNK2001: unresolved external symbol _meam_setup_global_
pair_meam.obj : error LNK2001: unresolved external symbol _meam_setup_param_
Debug/Lammps.exe : fatal error LNK1120: 7 unresolved externals
Error executing xilink6.exe.

what should i do now?

the problem is that you are mixing c++ and fortran code.
to call fortran from c++ you have to know the calling conventions
and the symbol naming conventions for fortran objects generated
by your fortran compiler. the code in pair_meam.cpp is written in
a way that only supports one subset (the most common one) of
these conventions. these apply for example to the GNU compilers
(g++ and gfortran) either via cygwin or mingw.

if you don't want any of those, you'll have to change the calling
and naming/underscoring conventions to whatever your compiler
is applying for fortran objects.

axel.

As an alternative to changing naming conventions within the code itself, you might be able to change some of the compile flags on either your C++ or fortran compiler (or both). For example, it looks like your C++ compiler is using a leading underscore on symbol names; the gnu compiler has a flag "-fno-leading-underscore" that can modify this behavior. I don't know exactly what compiler you're using in windows, but there may be similar options.

It's also often helpful to be able to query the fortran object files to see exactly what symbols are created, and where the compiler is putting those underscores. Under linux the "nm" command can be run on a .o file to list all the defined symbols, but again I don't know what the windows equivalent might be.

Regards,
Greg

Greg Wagner
Sandia National Laboratories
P.O. Box 969 MS 9409 Livermore, CA 94551
Tel: (925) 294-2180 Fax: (925) 294-3410
Email: [email protected]...