Eastsheng's Wiki

Fortran error

2020-04-16 18:11:28

[toc]

1. FFTW调用出错

1
2
3
4
5
6
7
/tmp/cc7nhiwo.o: In function `MAIN__':
xxx.f90:(.text+0x200c): undefined reference to `dfftw_plan_dft_1d_'
xxx.f90:(.text+0x202c): undefined reference to `dfftw_execute_dft_'
xxx.f90:(.text+0x203b): undefined reference to `dfftw_destroy_plan_'
xxx.f90:(.text+0x21be): undefined reference to `dfftw_plan_dft_1d_'
xxx.f90:(.text+0x21db): undefined reference to `dfftw_execute_dft_'
xxx.f90:(.text+0x21ea): undefined reference to `dfftw_destroy_plan_'
  • 解决方法:

    1
    gfortran xxx.f90 -L/usr/local/fftw/lib -lfftw3
  • 如果没有在xxx.f90include '/usr/local/fftw/include/fftw3.f'路径,仅仅include 'fftw3.f'

  • 则可以:

    1
    gfortran xxx.f90 -I/usr/local/fftw/include -L/usr/local/fftw/lib -lfftw3

参考链接:[1] https://blog.csdn.net/TedOne_LZ/article/details/89151411