2017-04-12 32 views
0

我想編譯一個使用Lapack函數的代碼。我按照(http://www.netlib.org/lapack/lawnspdf/lawn81.pdf)的主要說明安裝了Lapack和BLAS,我運行了測試,聽起來沒問題。即使在包含-lreflblas之後未定義的BLAS函數

然而,當我運行:

gfortran -L/home/user/Desktop/LAPACK -I/home/user/Desktop/LAPACK/include -llapack -llapacke -lrefblas -O3 lorenz96v4.f90 -o l96_2.x -ffree-line-length-200 

我獲得了一堆錯誤的(見下文)。庫liblapak.a和librefblas.a包含在/ home/user/Desktop/LAPACK中,並且所有頭文件都位於其中的include文件夾中。

下面是錯誤信息:

In function `testcorrelation_': 
lorenz96v4.f90:(.text+0x132d): undefined reference to `dgemv_' 
lorenz96v4.f90:(.text+0x171e): undefined reference to `dgemv_' 
lorenz96v4.f90:(.text+0x1787): undefined reference to `dgemv_' 
/tmp/ccU96uz3.o: In function `qr_': 
lorenz96v4.f90:(.text+0x1da0): undefined reference to `dorm2r_' 
lorenz96v4.f90:(.text+0x1dcb): undefined reference to `dgeqrf_' 
/tmp/ccU96uz3.o: In function `rungekutta4thtl_': 
lorenz96v4.f90:(.text+0x3653): undefined reference to `dgemm_' 
lorenz96v4.f90:(.text+0x36bf): undefined reference to `dgemm_' 
lorenz96v4.f90:(.text+0x3726): undefined reference to `dgemm_' 
lorenz96v4.f90:(.text+0x375a): undefined reference to `dlaset_' 
lorenz96v4.f90:(.text+0x3c88): undefined reference to `dgemm_' 
lorenz96v4.f90:(.text+0x3cf4): undefined reference to `dgemm_' 
lorenz96v4.f90:(.text+0x3d53): undefined reference to `dgemm_' 
lorenz96v4.f90:(.text+0x3d84): undefined reference to `dlaset_' 
/tmp/ccU96uz3.o: In function `MAIN__': 
lorenz96v4.f90:(.text+0x8cd6): undefined reference to `dgemm_' 
lorenz96v4.f90:(.text+0xa023): undefined reference to `dlaset_' 
lorenz96v4.f90:(.text+0xa195): undefined reference to `ilaenv_' 
lorenz96v4.f90:(.text+0xa276): undefined reference to `dgeqrf_' 
lorenz96v4.f90:(.text+0xb343): undefined reference to `dlaset_' 
lorenz96v4.f90:(.text+0xb4b5): undefined reference to `ilaenv_' 
lorenz96v4.f90:(.text+0xbfa2): undefined reference to `dgeqrf_' 
lorenz96v4.f90:(.text+0xc30d): undefined reference to `dtrtrs_' 
lorenz96v4.f90:(.text+0xc399): undefined reference to `dnrm2_' 
lorenz96v4.f90:(.text+0xceb5): undefined reference to `dorm2r_' 
collect2: error: ld returned 1 exit status 

它看起來像編譯器不承認或找到標題...誰能幫助我?

+0

如果你'gfortran -L/home/user中/桌面/ LAPACK -O3 lorenz96v4會發生什麼。 f90 -o l96_2.x -ffree-line-length-200 -I/home/user/Desktop/LAPACK/include -llapack -llapacke -lrefblas'即將庫放到最後?如果你做了'gfortran lorenz96v4.f90 /home/user/Desktop/LAPACK/librefblas.a ....'? –

回答

0

試試這個:

ln -s /home/user/Desktop/LAPACK/librefblas.a /home/user/Desktop/LAPACK/libblas.a 

還可以使用-lblas並更改連接順序:先

-llapacke -llapack -lblas 
+0

謝謝,但它不工作...我仍然得到相同的錯誤。 – Mallo96

相關問題