// f.for is a Fortran source file
// c.c is a C source file
# gfortran -c f.for // produce f.o
# gcc -c c.c // produce c.o
since f.for calls some functions from c.c. How can I produce a third object file fc.o which will be used later to generate an executable with another C source code. explain:
# gcc/gfortran? (or other) -?? f.o c.o -o fc.o
# gcc -o executable source.c fc.o
thank you
What I have done but not work:
# ar rvs fc.a f.o c.o
# gcc -o executable source.c fc.a
But it shows me error like : undefined reference to 'function_name_X'. function_name_X is in f.for
ar rvs fc.a f.o c.owill get you a static library (fc.a), which you can use as if it were an object file made by mergingf.oandc.o.ld -r f.o c.o -o fc.o, then? (Dark Falcon's link)