Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29008 Discussions

The name of the module procedure conflicts with a name in the encompassing scoping unit.

milenko1976
Beginner
2,617 Views
nf.f90(4): error #6645: The name of the module procedure conflicts with a name in the encompassing scoping unit. [GETVALUE]
function getvalue(PP)

This makes me crazy.
module nf
use definitions
contains
function getvalue(PP)

total = 0d0
do k = 1, n_data
row_sum = 0d0
do i = 1, c
dist_ik = vv(i,:)-x(k,:)
write(*,*)dot_product(dist_ik, dist_ik)
row_sum = 1.0/dot_product(dist_ik, dist_ik) + row_sum
end do
total = 1d0/row_sum + total
end do
getvalue= total

end function

end module
How it comes I can not compile module?Do I need interface?
0 Kudos
3 Replies
Steven_L_Intel1
Employee
2,617 Views
Does module DEFINITIONS declare something named getvalue? If it does, you'll get this error. One way to work around this is to rename the conflicting declaration to something else, for example:

use definitions, dummy1 => getvalue
0 Kudos
milenko1976
Beginner
2,617 Views
Ok,nut I made with pointer mistake again.
module definitions
implicit non
integer :: i,k,c,n_data
real,dimension(8,2) :: x
real,dimension(2,2) :: vv
real,dimension(2) :: dist_ik
real(kind(1d0)) row_sum, total
real,pointer :: dummy1(:)
Compile it end then where to put dummy1 => getvalue
module nf
use definitions

function getvalue(PP)
dummy1 => getvalue
Like this doesn't work.
milenko@milenkons:~/d$ ifort -c nf.f90
nf.f90(4): error #6218: This statement is positioned incorrectly and/or has syntax errors.
function getvalue(PP)
-------^
nf.f90(5): error #6274: This statement must not appear in the specification part of a module
dummy1 => getvalue

0 Kudos
mecej4
Honored Contributor III
2,617 Views
Replace

module nf
use definitions
contains
function getvalue(PP)

by

module nf
use definitions, dummy1=>getvalue
contains
function getvalue(PP)

Read the Fortran reference to understand what the bold text means.
0 Kudos
Reply