This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Combining C++ and fortran programs


Hi,

I have C++-Programs that I want to call from Fortran.

The name of the function in the C++-Programm cp.C is foo. But when I
compile the program with " g++ -c cp.C" then the name of the function
foo in the object modul is foo__FPi. When I compile the Fortan-Program
with "g77 -c -fno-underscoring fp.f", the name of the called subroutine
in the Fortran object modul is foo.  When I link the programms with
"g77 fp.o cp.o"I get the error message "undefined reference to `foo'".

I append the sample programms and the output of the commands "g77 -v"
and "g++ -v" to this mail. I would be very glad, if there is any way to
solve my problem.

Thankyou
Friedhelm David

sample.tgz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]