public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Linking c++ and fortran
@ 2000-03-07  9:14 Peter_Hahne
  2000-03-07 11:58 ` Martin v. Loewis
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Peter_Hahne @ 2000-03-07  9:14 UTC (permalink / raw)
  To: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 931 bytes --]

Hello

I´m trying to call a fortran routine from a c++ routine
using gcc resp. g77/g++ , but dont get it to work.
Can somebody tell me how to do it?

Best regards, Peter


I tried
	g77 -o main main.cpp sub1.f -lstdc++  

and get the linker error message
 
	/tmp/ccK77Fls.o: In function `main':
	/tmp/ccK77Fls.o(.text+0x26): undefined reference to `sub1_(void)'
	collect2: ld returned 1 exit status

I am using

g77 version egcs-2.91.66 19990314 (egcs-1.1.2 release) (from FSF-g77 version 
0.5.24-19981002)

The sourcefiles are main.cpp

#include "iostream.h"
int sub1_();
main()
{
	cout << "main" << "\n";
	sub1_();
}

and sub1.f

      integer function sub1()
      sub1=0
      write (6,*) 'sub1'
      return
      end

----------------------------------------------------------------------
Dr.Peter Hahne, Zum Pitschgrund 7a, 64747 Breuberg Rai-Breitenbach,
Tel. +49 6165 912424, Fax +49 6165 912425, Mobile +49 171 5178749

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-07  9:14 Linking c++ and fortran Peter_Hahne
2000-03-07 11:58 ` Martin v. Loewis
2000-03-07 13:38   ` Peter_Hahne
2000-04-01  0:00     ` Peter_Hahne
2000-04-01  0:00   ` Martin v. Loewis
2000-03-07 12:01 ` Alexandre Oliva
2000-03-07 13:40   ` Peter_Hahne
2000-04-01  0:00     ` Peter_Hahne
2000-04-01  0:00   ` Alexandre Oliva
2000-04-01  0:00 ` Peter_Hahne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).