Re: How can I simply use (old) routines?



Just add the statement

integer:: set_number

in your main program and it will work fine.

Cheers
Michael

Arno wrote:
Hi all,

I have a bunch of old routines, written by others, that I would like to
use in my code. However, it seems that I cannot access those routines
if I have an 'implicit none' in my program.

For example, the following does not compile:

** set_number.f90 **

integer function set_number(i)

implicit none
integer,intent(in) :: i

set_number = 2*i

end function set_number

**********************************
** main.f90 **

program test

implicit none
integer :: i,j

i = 1
j = set_number(i)
write(*,*) j

end program test

**********************************

g95 set_number.f90 main.f90
results in:
Error: Function 'set_number' at (1) has no implicit type

The intel compiler gives a similar error.

What is the problem here? Why does this not work?

I know two ways to solve it; make use of modules, or add a line
'integer :: set_number' in main.f90, but I just would like to know why
the code given above doesn't work.

Thanks!

Arno

.