[lammps-users] MEAM fortran Linking errors

Axel,
Thank you for your prompt response. I linked to ifort

CC = g++
CCFLAGS = -O -I…/STUBS -DFFT_NONE
DEPFLAGS = -M
LINK = ifort
LINKFLAGS = -O -L…/STUBS
-L/home/rutu/lammps-21Feb07/lib/meam
-L/opt/intel/fc/9.1.036/lib
USRLIB = -lmpi -lmeam
SYSLIB = -lstdc++

and I got

main.o: In function main': main.cpp:(.text+0x0): multiple definition of main’
/opt/intel/fc/9.1.036/lib/for_main.o:./src/libfor/for_main.c:(.text+0x0): first defined here
ld: Warning: size of symbol main' changed from 88 in /opt/intel/fc/9.1.036/lib/for_main.o to 168 in main.o /opt/intel/fc/9.1.036/lib/for_main.o: In function main’:
./src/libfor/for_main.c:(.text+0x3e): undefined reference to `MAIN__’

I am not sure if I’m doing this correctly,
Thank you,
Rutuparna

Axel,
Thank you for your prompt response. I linked to ifort

CC = g++
CCFLAGS = -O -I../STUBS -DFFT_NONE
DEPFLAGS = -M
LINK = ifort
LINKFLAGS = -O -L../STUBS \
                -L/home/rutu/lammps-21Feb07/lib/meam \
                -L/opt/intel/fc/9.1.036/lib
USRLIB = -lmpi -lmeam
SYSLIB = -lstdc++

and I got

main.o: In function `main':
main.cpp:(.text+0x0): multiple definition of `main'
/opt/intel/fc/9.1.036/lib/for_main.o:./src/libfor/for_main.c:(.text+0x0): first defined here
ld: Warning: size of symbol `main' changed from 88 in /opt/intel/fc/9.1.036/lib/for_main.o to 168 in main.o
/opt/intel/fc/9.1.036/lib/for_main.o: In function `main':
./src/libfor/for_main.c:(.text+0x3e): undefined reference to `MAIN__'

I am not sure if I'm doing this correctly,

yes you did. this was my mistake. you need another flag '-nofor-main'.
from ifort -help:

-nofor-main do not link against Fortran main object
               Used when linking Fortran objects with C main program

then it should work. sorry.

axel.