INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Day 1 with fortran... compiling errors... don't know where to go for help!

Day 1 with fortran... compiling errors... don't know where to go for help!

Day 1 with fortran... compiling errors... don't know where to go for help!

(OP)
Hi all,

I'm new here, first post. Was hoping someone here with some fortran knowledge could help me out with a little problem, and perhaps give me some general advice. This is DAY ONE of me using fortran, so please be patient. I am running gfortran on osx mavericks.

As an introductory project, I've been trying to use fortran to write a configuration script for gnuplot. My hope is to be able to loop over this code to make different versions of the configuration script. My efforts consist of two f03 files (raw code is below), one contains the program which calls a number of subroutines in order, and the other is a module with subroutines in it. First I compiled the "gnu_style" module, then I compiled the "test" program, then I tried to link them into an executable. The command line arguments I used are below:

$ gfortran -c gnu_style.f03
$ gfortran -c test.f03
$ gfortran gnu_style.o test.o -o testy

Unfortunately, the following error is returned:

Undefined symbols for architecture x86_64:
"_keyoff_", referenced from:
_MAIN__ in test.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

I've tried running the code with the -m32 and -m64 flags, and the error is the same. I also tried running them on another mac with gfortran, same error. I then ssh'd into a linux machine and ran the codes there, and it still doesn't like the _keyoff_ symbol. So I am guessing what I have is a programming issue. And if someone could help me with that by looking at the horrible, ignorant code below (I'll say it again, this is DAY 1 fortran), then I would be extremely grateful.

Thanks for your time,

==========================================
program test
use gnu_style
implicit none

real, parameter :: pi = 4*atan(1.0)

call style_new()
call pngcairo()
call output('frames/test')
call grid()
call keyoff()
call xrange(0.0,2.0*pi)
call yrange(-1.0,1.0)
call title('Animation')
call datafile('data/test')
call style_close()

end program test


======================

module gnu_style
implicit none

contains

subroutine style_new
open(unit=1, file='style.gnu')
end subroutine style_new
subroutine pngcairo
write (1,*) "set terminal pngcairo transparent enhanced font 'arial,10' fontscale 1.0 size 500, 300"
end subroutine pngcairo
subroutine output(filename)
character(12) :: filename
write (1,*) "set output'"//trim(filename)//"'"
end subroutine output
subroutine grid
write(1,*) "set grid"
end subroutine grid
subroutine xrange(xmin,xmax)
real :: xmin, xmax
character(8) :: strminx, strmaxx
write(strminx,'(f8.4)') xmin
write(strmaxx,'(f8.4)') xmax
write (1,*) "set xrange ["//trim(strminx)//":"//trim(strmaxx)//"]"
end subroutine xrange
subroutine yrange(ymin,ymax)
real :: ymin, ymax
character(8) :: strminy, strmaxy
write(strminy,'(f8.4)') ymin
write(strmaxy,'(f8.4)') ymax
write (1,*) "set yrange ["//trim(strminy)//":"//trim(strmaxy)//"]"
end subroutine yrange
subroutine title(titletext)
character(50) :: titletext
write (1,*) "set title '"//trim(titletext)//"'"
end subroutine title
subroutine datafile(datafilename)
character(50) :: datafilename
write (1,*) "plot 'data.dat' with linespoints ls6 lc7"
end subroutine datafile
subroutine style_close
close(unit=1)
end subroutine style_close

end module gnu_style

RE: Day 1 with fortran... compiling errors... don't know where to go for help!

You have a call to subroutine "keyoff", but you do not have such subroutine.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close