home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!spool.mu.edu!agate!ames!nsisrv!thuja!karl
- From: karl@thuja.gsfc.nasa.gov (Karl A. Anderson)
- Newsgroups: comp.sys.sun.apps
- Subject: Linking Fortran subroutine with C main program: "Compilation failed"
- Message-ID: <1992Dec16.135730.19707@nsisrv.gsfc.nasa.gov>
- Date: 16 Dec 92 13:57:30 GMT
- Sender: karl@thuja (Karl A. Anderson)
- Organization: NASA/GSFC Laboratory for Terrestrial Physics
- Lines: 28
- Nntp-Posting-Host: thuja.gsfc.nasa.gov
-
- The Sun Fortran User's Guide (p. 159) offers an example of how to call a fortran
- subroutine from a C main program. You compile SimRef.f and SimRefmain.c to
- object files separately, then link with "f77 SimRef.o SimRefmain.o". When we try
- this, we get the following error message:
-
- %ls
- SimRef.f SimRefmain.c
- %f77 -c SimRef.f
- SimRef.f:
- simref:
- %cc -c SimRefmain.c
- %f77 SimRef.o SimRefmain.o
- ld: Undefined symbol
- _MAIN_
- Compilation failed
-
- LD_LIBRARY_PATH is set correctly:
-
- %echo $LD_LIBRARY_PATH
- /usr/lang/SC1.0:/usr/lib:/usr/lib/X11:/usr/openwin/lib
-
- Despite the error message, a.out is created, and seems to work. Anybody have any
- ideas why we're getting the error? TIA.
-
- --
- Karl A. Anderson | Internet: karl@thuja.gsfc.nasa.gov
- NASA/GSFC code 920.2 (HSTX) | voice: (301) 286-3815
- Greenbelt, MD 20771 | #include "std_disclaimer"
-