Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
18 Views

How to create source code to open the compiler

Hello,

I have been trying for quite a few hours now both today and yesterday so I need fairly well explained instructions sorry - this  is my first time downloading coding software.

The instructions for the starting guide (file:///opt/intel/documentation_2019/en/compiler_f/ps2019/get_started_mf.htm)

say to put into the terminal something along the lines of:  ifort my_source_file.f90

How do I create this file? What is a text editor.. is this like TextEdit or Notepad on my Mac or is this something on XTools.

Either way do I create it and where do I save it so the terminal can find that file? 

Thank you so much for your help!

0 Kudos
2 Replies
Highlighted
Black Belt Retired Employee
18 Views

Are you on Linux or MacOS? Yes, TextEdit and Notepad are text editors. You can also create source files in Xcode.

0 Kudos
Highlighted
Black Belt
18 Views

Ta,

You should spend a few hours, if not a few days, using a program text editor, since you will be using that invaluable tool throughout your programming life.

If, however, you have a burning desire to create a test program, compile and run it, here are instructions:

1. Open the terminal. You will probably be in your "home directory". If not, you will need to create a working directory and change to it. If you do not know how to do any of this, you will have to consult tutorials and manuals until you can. Don't expect much tutoring here.

2. Create a small program source. First, type the command cat > hw.f90 and press the Enter/Return key. Now type the following lines:

program hw
print *,'My first Fortran program runs!'
end program

3. Type CTRL+D and then press the Enter/Return key.

4. Compile, link and run the program using the appropriate commands for doing so. Those commands will depend on which Fortran you have available on your system. If you do not have any, you have to obtain and install a compiler package first.

0 Kudos