ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The problem is coming for different version of gcc compiler .
the f90 program
Tringal.f90 is working without any error in gcc version
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
but for version
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
the error is as
gfortran -c Traingle.f90
Traingle.f90:16.26:
REAL :: a, b, c, Area
1
Error: Symbol 'area' at (1) already has basic type of REAL
Traingle.f90:19.14:
READ *, a, b, c
1
Error: Symbol 'a' at (1) has no IMPLICIT type
Traingle.f90:19.17:
READ *, a, b, c
1
Error: Symbol 'b' at (1) has no IMPLICIT type
Traingle.f90:19.20:
READ *, a, b, c
1
Error: Symbol 'c' at (1) has no IMPLICIT type
The Triangle.f90 program is
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
PRINT *, 'Welcome, please enter the&
&lengths of the 3 sides.'
READ *, a, b, c
PRINT *, 'Triangle''s area: ', Area(a,b,c)
END PROGRAM Triangle
The problem is coming for different version of gcc compiler .
the f90 program
Tringal.f90 is working without any error in gcc version
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
but for version
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
the error is as
gfortran -c Traingle.f90
Quote:
Traingle.f90:16.26:
REAL :: a, b, c, Area
1
Error: Symbol 'area' at (1) already has basic type of REAL
Traingle.f90:19.14:
READ *, a, b, c
1
Error: Symbol 'a' at (1) has no IMPLICIT type
Traingle.f90:19.17:
READ *, a, b, c
1
Error: Symbol 'b' at (1) has no IMPLICIT type
Traingle.f90:19.20:
READ *, a, b, c
1
Error: Symbol 'c' at (1) has no IMPLICIT type
The Triangle.f90 program is
Quote:
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
PRINT *, 'Welcome, please enter the&
&lengths of the 3 sides.'
READ *, a, b, c
PRINT *, 'Triangle''s area: ', Area(a,b,c)
END PROGRAM Triangle
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.