Invalid form for an assignment in Fortran
I can't get this code to compile uding either the g77 minGW compiler or the g95 compiler. Does anyone know why?
I get these errors with the g77:
diff5z10.for: In subroutine `diffract':
diff5z10.for:579:
    Tropo100 = 20.34 - .077 * Dist
             ^
Invalid form for assignment statement at (^)
diff5z10.for:581:
    IF (Freq .GT. 1000)  FreqAdj = 24.5 - 7200/(Freq+3000)
     ^
Invalid form for assignment statement at (^)
and i get these errors when compiling with g95:
In file diff5z10.for:574
  CLUTTER = steep*CLUTTER
  1
Error: Unclassifiable statement at (1) In file diff5z10.for:580
  FreqAdj = 23.978 - 58026.76 / (Freq + 2320)
  1
Error: Unclassifiable statement at (1)
here is the code from this section of the program: (starting with line 362)
   Span = .28 - .144 * (Round - 1.2)
   Para = C / Span**2
  IF (Ratio .GT. .4) Para = 6.25 * (C - 1)
  CLUTTER = Para * (RATIO - .4)**2 - C  
  IF (CLUTTER .GT. 0.) CLUTTER = 0.
  CSlope =  SQRT(freq)/3开发者_如何学运维50
  steep = 1 + CSlope * (dist - Horizon)
  IF (steep .LT. 0) steep = 0
  IF (steep .GT. 1) steep = 1
  CLUTTER = steep*CLUTTER
 Tropo100 = 20.34 - .077 * Dist
 FreqAdj = 23.978 - 58026.76 / (Freq + 2320)
 IF (Freq .GT. 1000)  FreqAdj = 24.5 - 7200/(Freq+3000)
 TropoFd = Tropo100 - FreqAdj
  FS_field = 106.9 - 20 * LOG10(Dist)     
  Scatter = TropoFd - FS_field         !loss ref to free space
  DiffL = Scatter  -  DLOSS
   Combine = 150/(20 - DiffL) - 5
  IF (DiffL .LT. -10) Combine = 0
  IF (DiffL .GT. 10)  Combine = DiffL
  DLOSS = DLOSS + Combine
  RETURN
  END
Assuming that the spacing in your snippet is reflective of what's actually in the source code, your compilers might getting confused with line-continuation characters (which, in archaic FORTRAN style fall in Column 6) or line number characters (Columns 1-5). There are a few things you could try:
- Enable free-form source in the compilation options
- Rename the file from myfile.ftomyfile.f90and recompile with g95
As always, when dealing with older-style code, the standard warnings such as "Always use implicit none also apply.
Did you check your indentation style? Sometimes your compiler will treat tabs in a badway, not knowing with how many spaces to replace them. It will then output seemingly random errors, because it doesn't understand where the line header is.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论