This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Combining C++ and fortran programs
- To: gcc-help at gcc dot gnu dot org
- Subject: Combining C++ and fortran programs
- From: Friedhelm David <FriedhelmDavid at awg dot dwd dot de>
- Date: Tue, 09 Oct 2001 09:39:42 +0000
- Organization: Amt fuer Wehrgeophysik - B III 2
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