Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function 'cosd' has no implicit type

Status
Not open for further replies.

Astrodude

Programmer
Jun 10, 2010
7
US
Hi all,

I'm in the process of debugging about 60 programs and could use a little help on this one before my brain is fried and fingers are cramped. I greatly appreciate your time. Thanks!

When I try to compile I receive the error:

In file dipole_tilt.f:30
% 19.3*cosd(3*al)
1
Error: Function 'cosd' at (1) has no implicit type


Here's my code:


subroutine dipole_tilt(glong, glat, utsec, tau, day, hgraze)
implicit none

real glong,glat,utsec,tau, season, cos tau, alpha, phi
real pi,c,theta, Sx, Sz, Nx, Nz, hgraze,Re,al,aet
integer*4 day
data alpha/.4089/
data pi/3.14159265/
data Re/6.37E3/
c = 2.*pi/360.

al = 278.895 + 0.985647*day
aet = -105.7*sind(al) + 596.2*sind(2*al) + 4.4*sind(3*al) -
% 12.7*sind(4*al) - 429.1*cosd(al) - 2.1*cosd(2*al) +
% 19.3*cosd(3*al)
season = 2.*pi*(day-173.21+((utsec-aet)/86400.))/365.25
phi = c*(glong + (utsec-aet)/240.)
theta = c*(90. - glat)

Sz = sin(alpha)*cos(season)
Sx = - sqrt(1-Sz*Sz)
Nx = cos(phi)*sin(theta)
Nz = cos(theta)

cos tau = Sx*Nx + Sz*Nz
tau = acos(cos tau)/c
hgraze = 0.
if(tau.eq.180.) hgraze = -1.
if ( (tau .gt. 90.) .and. (tau .ne. 180. ) ) then
hgraze = Re/sin((180.-tau)*c) - Re
end if
tau = tau - 90.

return
end















 
cosd and sind are not standard implicit functions. They're just functions that have been defined somewhere in your code. You need
Code:
real sind, cosd
 
Thank you.

I added 'real sind, cosd' which led to the following errors:

undefined reference to `sind_'
undefined reference to `cosd_'

In fact, I have this error in just about all of my programs. Is this due to a library or linking issue? How should I go about fixing this?
 
COSD seems to be an intrinsic in Microsoft's Developer Studio (and I suppose in Compaq's compiler as well).

However, it doesn't seem standard fortran, gfortran gives the same error to me "COSD Is not an intrinsic bla bla ...", neither does it appear in my fortran90 book.

I guess it's not standard.

If you got a long code, just define COSD as xwb said, like COSD=COS(x*pi/180) or something
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top