I'm trying to read columns from an input file in Fortran, to use them for other calculations.
When I compile with g ++ I read this error:
Undefined symbols for architecture x86_64:
"__gfortran_set_args", referenced from:
_main in ccOO2MBV.o
"__gfortran_set_options", referenced from:
_main in ccOO2MBV.o
"__gfortran_st_close", referenced from:
_MAIN__ in ccOO2MBV.o
"__gfortran_st_open", referenced from:
_MAIN__ in ccOO2MBV.o
"__gfortran_st_read", referenced from:
_MAIN__ in ccOO2MBV.o
"__gfortran_st_read_done", referenced from:
_MAIN__ in ccOO2MBV.o
"__gfortran_transfer_real", referenced from:
_MAIN__ in ccOO2MBV.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Where am I wrong? The code is this:
program columns
INTEGER,SAVE :: lun
INTEGER, PARAMETER :: ARRAYLEN=1440
CHARACTER :: filename
DOUBLE PRECISION, DIMENSION (1044) :: X_halo, Y_halo, Z_halo
INTEGER :: i
lun=1
filename = 'xyz.dat'
OPEN (1, FILE='xyz.dat',STATUS='old', ACTION='read', iostat=istat)
do i=1,1440
READ (1, iostat=istat) X_halo(i), Y_halo(i), Z_halo(i)
end do
CLOSE (1)
end program columns