This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
bug or wrong in my program?
- From: Gunnar <gunix at comhem dot se>
- To: fortran at gcc dot gnu dot org
- Date: Sat, 15 Jan 2005 23:24:39 +0100
- Subject: bug or wrong in my program?
- Reply-to: gunix at comhem dot se
Hello.
Now, I'm no fortran95 expert, but as far as I know, this should be an ok
fortran 95 program:
(but at the line I have marked HERE at the end of the message, I get the
compilation error:below.
( I use GNU Fortran 95 (GCC 4.0.0 20050115 (experimental)))
If I uncomment the "Area" part it compiles and runs perfectly!
In file ex1.f95:18
REAL :: a,b,c, Area
1
Error: Symbol 'area' at (1) already has basic type of REAL
In file ex1.f95:21
read*,a,b,c
1
Error: Symbol 'b' at (1) has no IMPLICIT type
In file ex1.f95:21
read*,a,b,c
1
Error: Symbol 'a' at (1) has no IMPLICIT type
In file ex1.f95:21
read*,a,b,c
1
Error: Symbol 'c' at (1) has no IMPLICIT type
In file ex1.f95:21
read*,a,b,c
1
Error: Symbol 'a' at (1) has no IMPLICIT type
In file ex1.f95:21
read*,a,b,c
1
Error: Symbol 'b' at (1) has no IMPLICIT type
In file ex1.f95:21
read*,a,b,c
1
Error: Symbol 'c' at (1) has no IMPLICIT type
In file ex1.f95:21
read*,a,b,c
1
Error: Symbol 'a' at (1) has no IMPLICIT type
======================================================
MODULE Triangle_Operations
IMPLICIT none
CONTAINS
FUNCtION Area(x,y,z)
real :: area ! function type
real, intent(in) :: x,y,z
real :: theta, height
theta=acos((x**2+y**2-z**2)/(2.0*x*y))
height = x*sin(theta); area=0.5*y*height
END FUNCTion area
end module Triangle_Operations
program Triangle
use triangle_operations
implicit none
REAL :: a,b,c, Area ! <<<<<<<<<-----------HERE!!!!!
print*, 'Hej och hå, skriv in &
& längderna på de tri siderna: '
read*,a,b,c
print*,'Triangel arean = ',Area(a,b,c)
end program triangle