我正在尝试编译一个使用Lapack函数的代码。我按照(http://www.netlib.org/lapack/lawnspdf/lawn81.pdf)的主要说明安装了Lapack和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 :(得分:0)
试试这个:
ln -s /home/user/Desktop/LAPACK/librefblas.a /home/user/Desktop/LAPACK/libblas.a
还使用-lblas并更改链接顺序:
-llapacke -llapack -lblas