I would like to ask for your help to compile a .f90 program that uses fftw3 (I am just learning Fortran and I got the code from someone else).
When I compile it, I get this error:
>> gfortran test1.f90
plo = fftw_plan_dft_1d(NT, IN, OUT, fftw_forward, FFTW_ESTIMATE)
1
Error: Function 'fftw_plan_dft_1d' at (1) has no IMPLICIT type
iplo = fftw_plan_dft_1d(NT, OUT, IN, fftw_forward, FFTW_ESTIMATE)
1
Error: Function 'fftw_plan_dft_1d' at (1) has no IMPLICIT type
I followed what is recommended in this link:
but I keep getting the error.
This is the code I am trying to compile:
!******************************
module FFTW3
use, intrinsic :: iso_c_binding
include "fftw3.f"
end module
module gst_module
use FFTW3
use omp_lib
implicit none
contains
subroutine transf(NT, x, IN)
implicit none
type(C_PTR) :: plo, iplo
integer (kind=4) i, j, NT ! , FFTW_ESTIMATE
real (kind=8) x(NT), h(NT)
complex (kind=8) y(NT), IN(NT), OUT(NT)
do i=1,NT
IN(i) = dcmplx(x(i),0.0d0)
end do
plo = fftw_plan_dft_1d(NT, IN, OUT, fftw_forward, FFTW_ESTIMATE)
iplo = fftw_plan_dft_1d(NT, OUT, IN, fftw_forward, FFTW_ESTIMATE)
call fftw_execute_dft(plo, IN, OUT)
! To make it shorter here I removed some lines of code that create the h vector
do i=1,NT
OUT(i) = OUT(i) * real(h(i),8)
end do
call fftw_execute_dft(iplo, OUT, IN)
! Here other lines of code using the results ..
call fftw_destroy_plan(plo)
call fftw_destroy_plan(iplo)
end subroutine transf
end module gst_module
!***************************
I tried to compile in Linux using this version:
>> gfortran --version
GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
And also in CYGWIN using:
>> gfortran --version
GNU Fortran (GCC) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
and in both cases I get the same error messages.
I have to say that the guy who shared the code does not get any error messages. He uses:
>> gfortran --version:
GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
I will appreciate your help A LOT.