- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
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?
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
use definitions, dummy1 => getvalue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page