Opening Fortran with Xcode

Opening Fortran with Xcode


I wanted open fortran by using xcode. I already spent a lot of time trying to understand what I am doing wrong. I am not able to figure it out. I checked the following website as well:

However, I am not able to work it.

My Xcode is version 4.6.3. My mac OS x is version 10.7.5. The fortran compiler is intel fortran composer xe 2013 for OS X student version.

When I go with the directions given in the link above, I see the following:

-Launch Xcode

-Create a new xcode project

-OS X -> Application ->Command Line tool->Next.

Product name: Hello


Uncheck automatic reference counting.

-Click next. Click Save.

-Move Main.cpp and Hello.1 to trash.

-File->New file->Fortran Fixed Format File.

I do not have Groups&Files under the Target group.

-Click on Targets-> Click on Build Rules.

-Click on Add Build Rule on the lower right.

-Under Process choose fortran source files.

-Under Using choose Intel Fortran Compiler XE 13.0 (Limited Feature).

Go to File.for. Enter the following:

    program Hello
    write(*,*) 'Hello'
    end program Hello


I get the following error line by line:

line1 program Hello

error #5149: Illegal character in statement label field.

error #5118: First statement in file must not be continues

line 2 write(*,*) 'Hello'

error #5082: Syntax error, found CHARACTER_CONSTANT

error #5149: Illegal character in statement label field

line 3 end program Hello

error #5082: Syntax error, found END-OF-FILE when expecting one of <LABEL> <END-OF-STATEMENT>

error #5149: Illegal character in statement label field

4 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

If you choose "Fixed Format File", you must type your Fortran source to match. Statements begin in column 7, etc.

Alternatively, choose "Free Format File" and give the file a name ending in .f90.


Thank you very much for your reply. It worked. Do you know where I can find the format for "Fixed Format File". I normally use Microsoft Visual Studio on my Microsoft and I use the format with .for. Is .f90 faster than .for?

I tested one of my fortran codes by using .f90 on Xcode. I have faced several problems.

Normally C and !! do commenting. However, this time C is not commenting. Is it possible to comment multiple lines by using Xcode?

A 'C' in column-1 designates the line as a comment, but only in fixed-format source.

For the rules of fixed-format and free-format source, see any Fortran text book, or in the Intel Fortran documentation->Language Reference->Program Elements and Source Forms.

You cannot have multi-line comments without each line being a comment (such as in C, where they are delimited by /* and */), but you can achieve the same effect using the preprocessor, using #if 0...#endif.

There should not be much difference in the speed of compiling free-format source versus fixed-format source.

I do not have a Macintosh, so I cannot comment about X-Code.

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!