I am working on a project that was given to me by someone else. This project contains a ton of .FOR files written in seemingly free- format. Recently I have been studying fortran code formats in a little more detail and came accross this article (https://software.intel.com/en-us/articles/intel-fortran-compiler-effect-of-file-extensions-on-source-form) which states:
".f90 specifies Fortran free-form source and .f, .ftn, or .for specify fixed-form souce"
I don't understand why and how these .FOR files can compile OK if they are written in free form, and if ifort recognizes them as fixed form. Could anyone please fill me in on this? I'm confused...
The Ifort compiler has a large number of options (as command line options or VS project settings) that let you specify that the compiler should assume (i) fixed form regardless of the file extension being ".f90", (ii) free form regardless of the file extension being ".for", etc.. There is also an option to tell the compiler to assume that certain files are Fortran source even if the file extension is something other than ".f", ".f90", etc., and the source code can contain embedded directives to allow parts of a source file to be fixed form while other parts of the same file are in free form.
Some of these issues were discussed in a recent thread, see https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/737148 .
@Mecej4 thanks for your response. I now understand that compilers generally use these options to tell the compiler to interpret the file independently of its extension. Since these files exist in Visual Studio, where can I find the ifort compiler options Visual Studio itself uses to compile these files? It would be useful to know since I am trying to gain a better understanding of how the solution is built....
The Visual Studio properties window for a Fortran source file or project contains a page Configuration Properties > Fortran > Command Line that tells you the command line options that will be used for a particular compile.
Amine A. wrote:
Since these files exist in Visual Studio
That is a distorted view of reality, similar to thinking that the Moon resides in a Telescope. My great grandmother, who was blind, used to ask how a grown man could fit into the radio box from which his voice emerged. [ In those days (1950-s) radios were made with vacuum tubes and no radio cabinet measured less than 1 ft3. Those cabinets provided spacious housing for biological mice, cockroaches and even scorpions, all standard elements of the UI. ]
Files exist on a storage device, whether that storage device is local, on a network or in the Cloud. The OS manages the files and provides controlled access to these files by such programs such as the compiler, Visual Studio, etc. VS options are stored in .vfproj files, and other configuration files can contain compiler options that are used. When you change or set options using the VS GUI and "save" the project, the .vfproj and .sln ("solution") reflect those changes.
VS provides a scrolling display of the build commands. A log of those commands and the compiler/linker responses are contained in an HTML file, "buildlog.htm"; that file can be saved elsewhere, and is often used in these forums to find out what exactly happened during a build.
See also IanH's reply. Some of the menus in VS allow you to add command line options (IFort has hundreds) for which there is no corresponding menu item provided.
@mecej4 ... Indeed. I am glad I sat down to look at it today and determine that the "Visual" component is just a glorified interface to control the various ifort commands and the core fortran components.
On another note... the moon doesn't reside in a telescope?! I have been lied to all my life...