I've trying to link a Fortran code to a C++ code.
First I create the object files for both languages:
g77 -c ckinterp.f math.f xerror.f cklib.f vode.f conp.f
g++ -c linear_alg.cpp teste.cpp
Than I use the g++ to link:
g++ -o jac *.o -lg2c -lm
The GCC returns a message like:
cklib.o: In function `ckcomp_':cklib.f:(.text+0x2b43): multiple
definition of `ckcomp_'
ckinterp.o:ckinterp.f:(.text+0xa9b3): first defined here
cklib.o: In function `ifirch_':cklib.f:(.text+0x17d58): multiple
definition of `ifirch_'
ckinterp.o:ckinterp.f:(.text+0xa8aa): first defined here
/usr/bin/ld: Warning: size of symbol `ifirch_' changed from 139 in
ckinterp.o to 164 in cklib.o
cklib.o: In function `ilasch_':cklib.f:(.text+0x17dfc): multiple
definition of `ilasch_'
ckinterp.o:ckinterp.f:(.text+0xa935): first defined here
/usr/bin/ld: Warning: size of symbol `ilasch_' changed from 126 in
ckinterp.o to 156 in cklib.o
cklib.o: In function `ipplen_':cklib.f:(.text+0x18654): multiple
definition of `ipplen_'
ckinterp.o:ckinterp.f:(.text+0xb1c7): first defined here
cklib.o: In function `ipparr_':cklib.f:(.text+0x1827b): multiple
definition of `ipparr_'
ckinterp.o:ckinterp.f:(.text+0xa491): first defined here
/usr/bin/ld: Warning: size of symbol `ipparr_' changed from 1049 in
ckinterp.o to 985 in cklib.o
cklib.o: In function `ippari_':cklib.f:(.text+0x17e98): multiple
definition of `ippari_'
ckinterp.o:ckinterp.f:(.text+0xa0ae): first defined here
conp.o: In function `MAIN__':conp.f:(.text+0x0): multiple definition of
`MAIN__'
ckinterp.o:ckinterp.f:(.text+0x0): first defined here
/usr/bin/ld: Warning: size of symbol `MAIN__' changed from 11317 in
ckinterp.o to 3528 in conp.o
xerror.o: In function `xerrwv_':xerror.f:(.text+0xfc0): multiple
definition of `xerrwv_'
vode.o:vode.f:(.text+0x7484): first defined here
/usr/bin/ld: Warning: size of symbol `xerrwv_' changed from 457 in
vode.o to 593 in xerror.o
/usr/bin/ld: cannot find -lg2c
collect2: ld returned 1 exit status
I don't understand this error since I'm not a programmer.
Does anybody here can help me?
Thanks.
Americo Junior