Fortran Compiling Help: Balaji's Physics Forum Inquiry

  • Fortran
  • Thread starter Bala06
  • Start date
  • Tags
    Fortran
In summary: 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).
  • #1
Bala06
10
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

  • x_y_input.txt
    392 bytes · Views: 421
  • program.txt
    933 bytes · Views: 434
Technology news on Phys.org
  • #2
You're missing the PROGRAM statement, which might be causing the compiler to not treat your comments correctly.
 
  • #3
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
 
  • #4
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.
 
  • #5
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
 

1. What is Fortran compiling and why is it important?

Fortran compiling is the process of converting human-readable Fortran code into machine-readable code that can be executed by a computer. It is important because it allows for the development and running of complex scientific simulations and calculations, particularly in the field of physics.

2. How do I compile Fortran code?

To compile Fortran code, you will need a Fortran compiler such as GNU Fortran, Intel Fortran, or IBM XL Fortran. The specific steps for compiling will vary depending on the compiler you are using, but generally you will need to use a command line interface and specify the source code file and any necessary libraries or flags. It is recommended to consult the documentation for your specific compiler for more detailed instructions.

3. What are some common errors encountered during Fortran compilation?

Some common errors that may occur during Fortran compilation include syntax errors, such as missing or misplaced punctuation, and logical errors, which cause the code to produce incorrect results. These errors can often be identified by the compiler and will provide an error message with information on how to fix the issue.

4. Can I compile Fortran code on any operating system?

Yes, Fortran code can be compiled on a variety of operating systems, including Windows, Mac, and Linux. However, you may need to use a different Fortran compiler depending on your operating system.

5. How can I optimize my Fortran code during compilation?

There are several ways to optimize your Fortran code during compilation, such as using compiler-specific optimization flags, avoiding unnecessary loops or function calls, and optimizing data storage. It is also helpful to use a profiler tool to identify and address any bottlenecks in your code.

Similar threads

  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
9
Views
9K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
4
Views
15K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
4
Views
13K
  • Programming and Computer Science
Replies
25
Views
10K
Back
Top