Fortran Fortran Compiling Help: Balaji's Physics Forum Inquiry

  • Thread starter Thread starter Bala06
  • Start date Start date
  • Tags Tags
    Fortran
AI Thread Summary
The discussion revolves around a compilation error encountered while trying to compile a Fortran program using the command "gfortran -ffree-form program.for." The user, Balaji, reports multiple errors, including "Name at (1) is too long" and "Unclassifiable statement at (1)." The issue is identified as stemming from the use of "C" for comments in a free-form source file, which the compiler misinterprets. A solution is suggested to replace "C" with "!" for comments, which resolves the compilation errors. Balaji confirms that this fix works successfully.
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
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
16
Views
2K
Replies
2
Views
3K
Replies
4
Views
16K
Replies
1
Views
2K
Replies
3
Views
14K
Replies
3
Views
12K
Replies
9
Views
9K
Back
Top