I have compiled a fortran file and an object file created.After that i tried to execute the object file but an error appears.The OS is Ubuntu and the error is below:
To compile the source file
gfortran -O3 reader.f iotools.c -o reader.x
To execute object file
gfortran reader.o
And the error
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function
_start': (.text+0x20): undefined reference tomain' reader.o: In functionMAIN__': fort77-2624-1.c:(.text+0xf): undefined reference toireadc_' fort77-2624-1.c:(.text+0x278): undefined reference tos_wsle' fort77-2624-1.c:(.text+0x291): undefined reference todo_lio' fort77-2624-1.c:(.text+0x2aa): undefined reference todo_lio' fort77-2624-1.c:(.text+0x2c3): undefined reference todo_lio' fort77-2624-1.c:(.text+0x2c8): undefined reference to `e_wsle' collect2: error: ld returned 1 exit status
reader.f file
ccccccccccccccccccccccccccccccccccccccccccccccccccccccc
C Basic fortran (and c tools) code to read fMRI images
C Compile linux:g77 -O3 reader.f iotools.c -o reader.x
c In Cygwin compile as : (to prevent max memory bug)
c g77 -o reader.x -Wl,--stack,8388608 reader.f iotools.c
c Execute: reader.x < imagename.img
c where "imagename.img" is a huge image fmri file
c------------------------------------------------------
c Standard output: the full correlation matrix
c------------------------------------------------------
parameter(maxsites=147456,maxtime=400,mintime=1)
real a(maxsites*maxtime), b(maxsites*maxtime)
real*8 ax, sxx(maxsites), sxy, r
integer iflag(maxsites)
c.... Read image file into a
i=ireadc(a,4*maxsites*maxtime)
do ix=1, maxsites
do it=1, maxtime
b((ix-1)*maxtime+ it) = a((it-1)*maxsites + ix)
enddo
enddo
do ix=1, maxsites
iflag(ix)=0
ax=0.d0
sxx(ix)=0.d0
do it=mintime, maxtime
ax=ax + dble(b((ix-1)*maxtime + it))
enddo
ax=ax/dfloat(1+maxtime-mintime)! mean activity for this voxel
if(ax.gt.7000.d0.and.ax.lt.14000) then
iflag(ix)=1 ! flag the usefull voxels
do it=mintime, maxtime
ic=(ix-1)*maxtime + it
b(ic) = b(ic) - ax
sxx(ix) = sxx(ix) + dble(b(ic)*b(ic))
enddo
endif
enddo
c--------------------------------------------------------------
do l1=1, maxsites-1
if(iflag(l1).eq.1) then
do l2=l1+1, maxsites
if(iflag(l2).eq.1) then
sxy=0.d0
do it=mintime, maxtime
ic1 = (l1-1)*maxtime + it
ic2 = (l2-1)*maxtime + it
sxy = sxy + dble(b(ic1)*b(ic2))
enddo
r=sxy/dsqrt(sxx(l1)*sxx(l2))!linear l1-l2 correlation
write(*,*) l1,l2,r
endif
enddo
endif
enddo
end
-cflag there AND-o reader.o. OR you should skip the second command.