What Could Be Causing Errors in My Fortran Program Compilation?

In summary, the problem is that the Fortran program is generating more error messages than it is outputting. Can you help me?
  • #1
jam_gha
7
0
Hi there

I compile the following Fortran program but it shows more error it output file.
can you help me.

with Regards,
jamshid

INCLUDE '(SCOHLP)'
INCLUDE '(PAPROP)'
*
*
******LOGICAL LFIRST
******SAVE LFIRST, ZMIN, DELTAZ
******DATA LFIRST /.TRUE./
* Initialization, to be done only at first call
******IF (LFIRST) THEN
*********LFIRST = .FALSE.
* It is always good to write a warning on standard output that a
* user routine has been used
*********WRITE(LUNOUT,*)
*****& "**** Using routine fluscw to get differential yield in z ****"
*********ZMIN = 5.D+00 ! write here the limits of the z range
*********ZMAX = 45.D+00 ! where you want to do the scoring
*********NINTRV = 400.D+00 ! and the number of z intervals
*********DELTAZ = (ZMAX - ZMIN)/DBLE(NINTRV)
******END IF
******FLUSCW = ONEONE
******LSCZER = .FALSE.
* The following applies only to yield detectors (there could be others)
******IF (ISCRNG .EQ. 5) THEN
* find the z interval number
*********INTERV = INT((ZZ - ZMIN)/DELTAZ) + 1
* don't score if detector number is different from interval number
*********LSCZER = JSCRNG .NE. INTERV
* multiply the score by 4pi to get integral result in omega
*********IF (.NOT. LSCZER) FLUSCW = FOUFOU * PIPIPI
******END IF
******RETURN
******END
 
Technology news on Phys.org
  • #2
When your post includes code (especially Fortran which is column dependent), you can post it in advanced mode (button below message window), select the text of the code and press the code button. The columns will be preserved and it will be easier to understand than forcing spaces with asterisks.

Also, code with include statements automatically means that the source code is incomplete, and your chances of getting help is reduced, unless the problem occurs clearly in the section of code posted.

This brings us to the third point, which is it is up to you to indicate where the problem is. The code you posted is incomplete, so readers cannot compile it to see where the problem is, the error messages have not been posted nor described, so it would not be surprising that you did not get help.

To sum it up, you need to help yourself by posting exactly what is bothering you, and what you expect for help.

Hope that helps.
 
  • #3


Hello Jamshid,

Thank you for reaching out for help with your Fortran program. It seems like there may be some errors in your code that are causing issues during compilation. Without seeing the exact error messages, it's difficult for me to pinpoint the exact problem, but here are a few potential solutions that may help:

1. Check for typos or syntax errors in your code. Even a small mistake can cause the entire program to fail during compilation.

2. Make sure all necessary libraries and modules are included in your program. It looks like you are already including two modules, but double check that they are the correct ones for your program.

3. Use a debugging tool to help identify where the errors are occurring. This can help you narrow down the problem and make fixes more efficiently.

I hope these suggestions can help you identify and resolve the errors in your program. Best of luck with your project!

Sincerely,
 

What is a compiler error in Fortran?

A compiler error in Fortran is an error that occurs during the process of converting source code into an executable program. This type of error typically occurs due to syntax errors or logical errors in the code.

Why do compiler errors happen in Fortran?

Compiler errors in Fortran can happen for a variety of reasons, such as incorrect syntax, typos, missing semicolons, or using variables that have not been declared. These errors occur because the compiler is unable to understand and translate the code correctly.

How do I fix a compiler error in Fortran?

To fix a compiler error in Fortran, you will need to carefully review your code and identify the source of the error. This may involve checking for typos, ensuring proper syntax, and making sure all variables are declared correctly. Once you have identified the error, you can make the necessary changes to fix it.

Can I prevent compiler errors in Fortran?

While it is not always possible to prevent compiler errors in Fortran, you can reduce the likelihood of them occurring by following good coding practices. This includes using proper indentation, commenting your code, and testing your code frequently to catch errors early on.

Is there a way to debug compiler errors in Fortran?

Yes, there are several ways to debug compiler errors in Fortran. You can use a debugger tool, such as GDB, to step through your code and identify the source of the error. Additionally, you can use print statements to track the values of variables and identify where the error is occurring.

Similar threads

  • Programming and Computer Science
Replies
9
Views
9K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
5
Views
3K
  • Programming and Computer Science
Replies
4
Views
3K
Back
Top