Results 1 to 4 of 4

Thread: Compiling gfortran with blas

  1. #1
    Join Date
    May 2012
    Beans
    2

    Compiling gfortran with blas

    Hi.

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

    Code:
          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

    Code:
    /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.

  2. #2
    Join Date
    Jul 2007
    Location
    Magic City of the Plains
    Beans
    Hidden!
    Distro
    Xubuntu Development Release

    Re: Compiling gfortran with blas

    Moved to Packaging and Compiling Programs.

  3. #3
    Join Date
    Apr 2009
    Location
    Germany
    Beans
    2,134
    Distro
    Ubuntu Development Release

    Re: Compiling gfortran with blas

    try
    Code:
    gfortran test.f -lblas
    libraries should always go behind objects needing them

  4. #4
    Join Date
    May 2012
    Beans
    2

    Re: Compiling gfortran with blas

    Thanks.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •