# How to resolve Implicit type related error?

**URL:** <https://fortran-lang.discourse.group/t/how-to-resolve-implicit-type-related-error/7359>\
**Category:** Help\
**Created:** [February 7, 2024, 2:12pm UTC](https://fortran-lang.discourse.group/t/how-to-resolve-implicit-type-related-error/7359 "2024-02-07T14:12:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajasmita](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@Rajasmita](https://fortran-lang.discourse.group/u/Rajasmita)\
**Post date:** [February 7, 2024, 2:12pm UTC](https://fortran-lang.discourse.group/t/how-to-resolve-implicit-type-related-error/7359/1 "2024-02-07T14:12:24Z")

</div>

![Fortran 90 profram error](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/d/d4876e68e5e24a01628d50e3f95b2ccbd1f428a8.png)  
I am trying to run fortran 90 code file but i am getting these error. Can anyone please help me to fix these errors ?

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [February 7, 2024, 2:27pm UTC](https://fortran-lang.discourse.group/t/how-to-resolve-implicit-type-related-error/7359/2 "2024-02-07T14:27:03Z")

</div>

In general please show your code when asking for help. From the error messages I think the first problem is that you are invoking the `random_number` intrinsic as a function, when it is actually a subroutine. You could write a function to wrap `random_number`, for example

```auto
module ran_mod
implicit none
integer, parameter :: dp = kind(1.0d0)
contains
function rannum() result(xran)
real(kind=dp) :: xran
call random_number(xran)
end function rannum
end module ran_mod

program main
use ran_mod, only: rannum
implicit none
call random_seed()
print*,rannum()
print*,rannum()
end program main

```

with sample output

```auto
  0.63224103693793376     
  0.99794562181167690

```

---

<div class="post-metadata">

**Author:** ![everythingfunctional](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/everythingfunctional/32/176_2.png) [@everythingfunctional](https://fortran-lang.discourse.group/u/everythingfunctional)\
**Post date:** [February 7, 2024, 2:28pm UTC](https://fortran-lang.discourse.group/t/how-to-resolve-implicit-type-related-error/7359/3 "2024-02-07T14:28:30Z")

</div>

First, `random_number` is a subroutine, not a function. Instead you’ll need to do

```auto
call random_number(harvest)
test=... harvest ...

```

Next, it looks like you’re missing a use statement to bring the `ch_nn` function into scope, or a declaration if the function is not in a module. You’ll need one of the following.

1. a use statement if the function is in a module. I.e.

```auto
use module_where_ch_nn_is

```

1. an interface block. I.e.

```auto
interface
  function ch_nn(x)
    real, intent(in) :: x
    real :: ch_nn
  end function
end interface

```

1. an external declaration, but I recommend against it because then the compiler won’t tell you if you got the wrong number or types of arguments. I.e.

```auto
real, external :: ch_nn

```
