Am Montag, 17. Juli 2006 18:06 schrieb Americo Barbosa da Cunha Junior: > 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 If you read the error messages your problem comes out quite clearly. There are definitions of symbols (functions or global variables) that exist in two files. Here for example there is a cklib.o and a ckinterp.o that both seem to contain ckcomp_ So you should first check if these functions might have been introduced in both fortran files. Note that the fortran name of ckcomp_ might be ckcomp or CKCOMP (I don't know the right name translation). > 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 you also seem to have multiple main entry points. > xerror.o: In function `xerrwv_':xerror.f:(.text+0xfc0): multiple > definition of `xerrwv_' > vode.o:vode.f:(.text+0x7484): first defined here some of your multiple definitions might also come from include files. But I'm not that sure about include files in fortran. > /usr/bin/ld: Warning: size of symbol `xerrwv_' changed from 457 in > vode.o to 593 in xerror.o if you aren't a programmer and more special the programmer of that code, you should ask the programmer to provide a valid make file. When I'm right your ckinterp is a part of the CHEMKIN Software which isn't open source and seemed to be under some restricted license. But if you have access to this software there should be an API Documentation.