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]
Other format: [Raw text]

Problems to link C++ files to a Fortran 77 file


From Gustavo,

	At this moment I am writing a simulation program
that uses some C++ routines and one Fortran procedure. I've read
the manual on all the subsections about interoperability between C
and Fortran:

http://gcc.gnu.org -> Manual -> GCC 3.2.2 G77 Manual
	-> Other Languages -> Interoperating with C and C++

Even after following the instructions inside, I couldn't link
all the modules together.

	The first problem happened as I tried to include the
file g2c.h.  Whenever I included it in a C code, the compiler emits
an error at line 21:

line 21 -> typedef __g77_integer integer;

It happened because nowhere the type __g77_integer
is declared. So the first question is: how do I use the include
file g2c.h properly?

	The second problem is fatal and happened during linkage.
Following the manual's advice I linked the code with g77,
but g77 couldn't find the C++ intrisics like std::cout.
Then I decided to link all the files with gcc, however in this case
all the fortran intrisics couldn't be found, for example the function _s_rnge,
used for check array bound, archived in libg2c.a.
Then I tried to use ld, and in this case the intrisics of both
had not been found. All these errors appeared even if
I forced the linker to include the adequate libraries; libg2c.a, libstd++.a
and so forth.

	Then I ask how do I link the modules? What is the diference
between linking with g77, g++ or ld? If these linkers behaved equally,
then they would collect the symbols equally.

Thanks for your help,

Gustavo.


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