PDA

View Full Version : Compiling gfortran with blas



sdventura
May 31st, 2012, 11:09 PM
Hi.

I recently upgraded to ubuntu 12.04. I am trying to compile the following simple code in fortran using the blas library.



program test

double precision a(5), b(5)
integer i

do i= 1,5
a(i)= i
enddo

call dcopy(5, a, 1, b, 1)

do i= 1,5
write(*,*) b(i)
enddo

end program
I am trying to compile with the command line "gfortran -lblas test.f". However, I get the error message



/tmp/ccGxeiUD.o: In function `MAIN__':
problem.f:(.text+0x5e): undefined reference to `dcopy_'
collect2: ld returned 1 exit status
I have both the packages libblas-dev and libblas3gf installed.
I just cannot understand what is going on.

I hope someone can help me.

Thank you in advance.

oldos2er
June 1st, 2012, 03:05 AM
Moved to Packaging and Compiling Programs.

MadCow108
June 1st, 2012, 09:43 PM
try
gfortran test.f -lblas
libraries should always go behind objects needing them

sdventura
June 2nd, 2012, 12:10 AM
Thanks.