I'm fairly new to fortran so I'm going to give more info than I probably need to.
I need to write a program that takes arguments from the command line at execution. For instance, when I run the program I might type
./a.x myfile.txt
My fortran program would read the argument myfile.txt from the command line and then create a file with that name and write some data to it.
A very simple version of my code is:
PROGRAM ci1
implicit none
character(len=20) :: filename
call getarg(1,filename)
open(unit=20,file=trim(filename),action="write")
write(20,*) "data ..."
close(20)
end program
to compile it I am typing (using the absoft compiler):
f95 ci1.f90 -o ci1.x
The output from the compiler reads:
/usr/bin/ld: Undefined symbols:
_GETARG
/tmp/RFXbDO/ci1.o reference to undefined _GETARG
collect2: ld returned 1 exit status
link failed.
In doing research I also found reference to a command called GET_COMMAND_ARGUMENT and got an error in compiling that as well.
Any help would be greatly appreciated.
-Eric