Errors in compiling FORTRAN
Hello, Folks:
I am trying to compile, or call, FORTRAN modules with respect to sm. I have successfully (?) installed sm on a Fedora 12 64-bit system using instructions given here (http://www.supermongo.net/compiling-with-linux-kernel-26-fc10). This seemingly allowed sm to compile and install.
I am now trying to compile a progam using sm. The command is:
gfortran -o tastrom tastrom.f -lplotsub -ldevices -lutils -lsla_f -L/usr/local/lib -L/usr/X11R6/lib -lX11
This gives errors such as:
/tmp/ccSKiVDt.o: In function `MAIN__':
tastrom.f:(.text+0x10c6): undefined reference to `sm_device_'
tastrom.f:(.text+0x1113): undefined reference to `sm_graphics_'
tastrom.f:(.text+0x1131): undefined reference to `sm_limits_'
tastrom.f:(.text+0x1191): undefined reference to `sm_erase_'
tastrom.f:(.text+0x121c): undefined reference to `sm_curs_'
tastrom.f:(.text+0x12bf): undefined reference to `sm_erase_'
tastrom.f:(.text+0x1405): undefined reference to `sm_erase_'
tastrom.f:(.text+0x159d): undefined reference to `sm_erase_'
tastrom.f:(.text+0x16a9): undefined reference to `sm_erase_'
/tmp/ccSKiVDt.o: In function `doplot_':
tastrom.f:(.text+0x31dd): undefined reference to `sm_ctype_'
tastrom.f:(.text+0x31f1): undefined reference to `sm_grelocate_'
tastrom.f:(.text+0x3205): undefined reference to `sm_label_'
tastrom.f:(.text+0x3223): undefined reference to `sm_box_'
tastrom.f:(.text+0x3237): undefined reference to `sm_xlabel_'
tastrom.f:(.text+0x324b): undefined reference to `sm_ylabel_'
tastrom.f:(.text+0x32bb): undefined reference to `sm_gflush_'
Now Ryan had a seemingly similar error here (http://www.supermongo.net/callable-supermongo) and a fix that seemed to indicate that gfortran appends a single underscore to functions, most others append two. He also said that options.h was set to follow along with two underscores by default, but checking my options.h that did not seem to be the case.
From options.h:
#define FORTRAN_APPEND _
Does anyone have any thoughts? I'm not sure where to go from here?
----
Doc Kinne (rkinne @ aavso.org)
AAVSO
- Forums:
Who's online
Online users
- karuiner

Fixed!
I found that FORTRAN_APPEND is actually defined twice in options.h. Later on, toward the end of the file, we find this:
#if defined(linux)
# if !defined(unix)
# define unix
# endif
# define _POSIX_SOURCE 1
# define FORTRAN_APPEND __
# define HAVE_IOCTL_DEFN
# define FD_SET_H
#endif
Changing this to one underscore solved my problem.