Fortran Compiling Help: Balaji's Physics Forum Inquiry

  • Context: Fortran 
  • Thread starter Thread starter Bala06
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary

Discussion Overview

The discussion revolves around issues encountered while compiling a Fortran program, specifically focusing on error messages related to comment formatting and the inclusion of the PROGRAM statement. Participants provide suggestions and clarifications regarding the compilation process using the gfortran compiler.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • Balaji reports errors during compilation, including "Name at (1) is too long" and "Unclassifiable statement at (1)," and seeks assistance.
  • Some participants suggest that the absence of the PROGRAM statement may lead to the compiler misinterpreting comments.
  • Another participant advises replacing the leading "C" in comments with "!" to conform to the free-form source file format, which may resolve the compilation errors.
  • Balaji confirms that following the advice to change comment formatting resolved the issues encountered during compilation.

Areas of Agreement / Disagreement

There is no consensus on the initial cause of the errors, as multiple suggestions are provided regarding the PROGRAM statement and comment formatting. However, Balaji acknowledges that the suggested changes helped resolve the compilation issues.

Contextual Notes

The discussion highlights the importance of understanding comment formatting in free-form Fortran source files and the potential confusion arising from the absence of specific statements.

Bala06
Messages
10
Reaction score
0
Dear Physics forum

I tried to compile fortran program using the command "g77-ffree-form program.for", while compiling it shows following error.

C:\Documents and Settings\Balaji\Desktop\Fortaran>gfortran -ffree-form program.f
or
program.for:1.64:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCO
1
Error: Name at (1) is too long
program.for:2:


CCC PROGRAM: POPULATIONS OF C-ALPHA TO 2D MAP
1
Error: Unclassifiable statement at (1)
program.for:3.64:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCO
1
Error: Name at (1) is too long
program.for:7:


CCC DEFINE OCCUPIED GRIDS ON XY PLANE
1
Error: Unclassifiable statement at (1)
program.for:14:

CCC OPEN DATA FILE
1
Error: Unclassifiable statement at (1)
program.for:17:

CCC READ INPUT DATA
1
Error: Unclassifiable statement at (1)
program.for:28:


CCC WRITE DATA FOR SIGMAPLOT
1
Error: Unclassifiable statement at (1)
program.for:34.64:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCO
1
Error: Name at (1) is too long

C:\Documents and Settings\Balaji\Desktop\Fortaran>

Let me know wats wrong while compliling.


Many Thanks
Balaji
 

Attachments

Technology news on Phys.org
You're missing the PROGRAM statement, which might be causing the compiler to not treat your comments correctly.
 
Mark44 said:
You're missing the PROGRAM statement, which might be causing the compiler to not treat your comments correctly.


Dear Mark

In the code, the "PROGRAM" statement is included.

Let me know exactly where to include, because I'm not a fortran expert.

Many Thanks
Balaji
 
Bala06 - your using "free-form" source file format. Try replacing the leading "C" in each comment with "!". This seemed to work for me (using gfortran compilier).

I suspect the possible cause of this error is that the compilier can not distinuish your "comments" from an attempt to define a symbol - this is a reason that the usual "...the character 'C' in column one ..." rule is thrown out for comments in free format source files. You must use the "!" comment character.
 
Mark44 said:
You're missing the PROGRAM statement, which might be causing the compiler to not treat your comments correctly.

TheoMcCloskey said:
Bala06 - your using "free-form" source file format. Try replacing the leading "C" in each comment with "!". This seemed to work for me (using gfortran compilier).

I suspect the possible cause of this error is that the compilier can not distinuish your "comments" from an attempt to define a symbol - this is a reason that the usual "...the character 'C' in column one ..." rule is thrown out for comments in free format source files. You must use the "!" comment character.


Dear McCloskey

Thanks that works fine.


Many Thanks
Balaji
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 9 ·
Replies
9
Views
10K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 4 ·
Replies
4
Views
17K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
12K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 3 ·
Replies
3
Views
14K