- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does anyone of you can help me please? I am very new to the FORTRAN and never used it before. I am using Visual Studio 2012 and I think it already has FORTRAN compiler inside the Visual Studio. Every time when I hit "start" to build my program to get results, it gives me the following two errors:
1) Error 1 error #5082: Syntax error, found '=' when expecting one of: ( , <END-OF-STATEMENT> ; <IDENTIFIER> <INTEGER_CONSTANT> <POUND_VAL> <INTEGER_KIND_CON> ... C:\Users\tborisovich\Documents\Winter2015\New Folder\615\A2\Prog\Draft1_fixed.f90 39
2) Error 2 Compilation Aborted (code 1) C:\Users\tborisovich\Documents\Winter2015\New Folder\615\A2\Prog\Draft1_fixed.f90 1
Why is that?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you click on the error in the output window it will jump the cursor to the code line at fault. You have:
do=ix, WIDTH which is illegal I think you should have do ix=1, width
there are other problems as width is not given a type and by default variables starting with the letters I,J,K,L,M,N are integer and the rest are assumed real unless declared otherwise.
I would strongly recommend adding IMPLICIT NONE after the program statement. this will give an error for every variable that is not declared.
I would then declare all the variable of the type they are meant to be e.g Integer width, ix,i ,j
You will also find there are a lot more errors in both code and logic in the program, but getting types correct is the first thing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you app4619 for your answer, but i was given the width and length, and declared it at the very beginning of the programming:
WIDTH = 86
LENGTH = 717
I am very new to this so going to follow your advice and see if it works or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
and where should i put the command implicit none?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just changed it as you advised and ran it again do=ix, WIDTH which is illegal I think you should have do ix=1, width
And now it gives me lots of errors:( Why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tom L. wrote:
Thank you app4619 for your answer, but i was given the width and length, and declared it at the very beginning of the programming:
WIDTH = 86
LENGTH = 717
I am very new to this so going to follow your advice and see if it works or not.
[/quote
That is an assigmnet of value not a declaration of type.
program FMI !c !c FMI !c IMPLICIT NONE integer maxdat parameter(MAXDAT=700) real x(100000),y(100000),z(100000),test(10000000) real xtmp(MAXDAT),ytmp(MAXDAT),ztmp(MAXDAT) real gsc(100000),vsh(MAXDAT),ps(MAXDAT) real avg(nx) integer width, length, ix, iy, lun, i, j WIDTH = 86 LENGTH = 717 !c !c Read the data !cAs a starter....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For some reason it looked at that one line that was very wrong and aborted without reporting all the other errors.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have one line with a length of over 800 characters. What this implies is that there are many chunks of Fortran code that are ignored by the compiler, causing it confusion in analyzing the code. Fix this problem first, and check if you have any other such long lines. Although the compiler has options to make it accept long lines, those options will not work in this case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to go through each variable and conclude if it is integer and real and declare it.
\Console4.f90(132): error #6404: This name does not have a type, and must have an explicit type. [MWIN] \Console4.f90(136): error #6404: This name does not have a type, and must have an explicit type. [NUM] \Console4.f90(137): error #6404: This name does not have a type, and must have an explicit type. [NWIN] \Console4.f90(141): error #8093: A do-variable within a DO body shall not appear in a variable definition context. [IX] \Console4.f90(141): error #6511: This DO variable has already been used as an outer DO variable in the same nesting structure. [IX] \Console4.f90(144): error #6404: This name does not have a type, and must have an explicit type. [GS] \Console4.f90(148): warning #7319: This argument's data type is incompatible with this intrinsic procedure; procedure assumed EXTERNAL. [REAL] \Console4.f90(148): error #6404: This name does not have a type, and must have an explicit type. [REAL] \Console4.f90(151): error #6404: This name does not have a type, and must have an explicit type. [IMX] \Console4.f90(152): error #6404: This name does not have a type, and must have an explicit type. [XMX] \Console4.f90(166): error #6404: This name does not have a type, and must have an explicit type. [NY] \Console4.f90(167): error #6423: This name has already been used as an external function name. [GS] \Console4.f90(167): error #6515: This function, which is specified as the left side of an assignment statement, is invalid. [GS] \Console4.f90(195): error #6404: This name does not have a type, and must have an explicit type. [XANGLE] \Console4.f90(197): warning #7319: This argument's data type is incompatible with this intrinsic procedure; procedure assumed EXTERNAL. [SIN] \Console4.f90(197): error #6404: This name does not have a type, and must have an explicit type. [SIN] \Console4.f90(216): error #6404: This name does not have a type, and must have an explicit type. [PWIDTH] \Console4.f90(224): error #6404: This name does not have a type, and must have an explicit type. [NVAR] \Console4.f90(229): error #6404: This name does not have a type, and must have an explicit type. [LOC] \Console4.f90(105): error #6591: An automatic object is invalid in a main program. [AVG] \Console4.f90(105): error #6279: A specification expression object must be a dummy argument, a COMMON block object, or an object accessible through host or use association. [NX]
You will also note array gsc is 2D and you have declared it 1D: real gsc(86,717) is the smallest size you can use.
other arrays are not declared, and I think GS is a typo for GSC. One of your nested do loops has both indexes is IX one should be IY I think.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since it is a .f90 file, Intel Fortran will easily take an 800-character line. I think it will go up over 1000 chars. Of course, the standard limit is 132.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem with the long line is that it contains a large number of statements separated only by blanks. The second of these starts beyond column 72, and many text editors would not display any but the first statement. Such a situation can cause the issue of numerous error messages that are mysterious.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not seeing a long line in the source file attached. I do see that it has Linux-style line endings, but ifort can handle that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Lines 51 to 78 end with just LF, the rest end with CR/LF. My editor got confused by the switch from CR/LF to just LF at line 51.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you all for your reply and suggestions! Greatly appreciated!
I am now very confused because all of you guys using a professional programming language including all abbreviations etc..What CR/LF could mean? If .f90 can read long lines why I am still getting lots of errors?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'll gladly explain, although you should not put off reading books to learn Fortran. Fortran program files are "text files", which consist of lines of "text". Text consists of alphabetical, numeric and punctuation characters, plus a few that are "white-space". Two white-space characters used to end lines of text are the Carriage-Return (CR, char(13)) and Line-Feed (LF = char(10)). These characters were used in old Teletype machines and line-printers to return the carriage containing the platten and paper to the left, and to roll the paper up one line.
On old computers, each line of text was punched on one 80-column card. The line terminator was the physical edge of the card. On a modern computer system, text files are stored electronically and have different conventions for line termination. On Linux and Unix systems, LF is the line terminator. On Windows, the MSDOS convention is still used: CR+LF is the line terminator, although most utilities accept LF by itself. Old MACOS systems used CR as the line terminator. However, when a single file contains more than one type of line terminator, utilities, compilers (and forum readers such as myself) can get confused.
The line termination question was a red herring, now known as such, for your program. However, there are numerous errors in the program which cannot be fixed without having a basic grasp of the programming language. Just as correcting the grammar in the text of a poem does not make it meaningful, let alone beautiful, correcting your program to make it syntactically correct with the guidance of forum readers is not going to be of much use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much app4619 for your quick reply and suggestions!
Well, I followed your suggestions and changed a couple of things in my program, and now it looks just not good as when I ran I received more than 10 errors, which is very annoying for me.
TL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot mecej4 for your comments and advice!
Could you guys recommend me a good book to start with? I did find lots of information, including books for the FORTRAN, but I really do not know which one is really good for beginners like myself. I really want to better understand and have that very basic grasp of the programming language.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A better recommendation would be possible if you stated what your background is. Do you have experience programming in another language, such as C or Basic? What kind of Fortran program do you seek to construct, and what is the application area (such as physics, finance, etc.)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, mecej4! I do not have any background in any of those programming languages. I have a background in engineering, but never used any programming languages before nor never taken programming courses during school. Once again, I do not have any programming experience in other languages, such as C and Basic. I want to use Fortan for programming, let's say, in statistics and heavy industry. How can I learn very quickly and what would be your recommendation for me in this particular case? I know there are many books and sources online, but which one is good?
It is very difficult for me to understand even simple lines when I start writing a very simple program; and have to spend lots of time trying to understand/figure out the meaning of the symbols, lines etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Google fortran tutorial and you will find a number of free resources that should help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some of the items below are free, but others are published/printed books. Some of the books may be available online.
A compact presentation of modern Fortran is given in http://people.cs.vt.edu/~asandu/Deposit/Fortran95_notes.pdf . Another is Modern Fortran Explained, by Metcalf et al. A good comprehensive guide is The Fortran 2003 Handbook by Adams, Brainerd, Hendrikson, Maine, Martin and Smith (Springer). An excellent online guide, but for the older Fortran 77, is Professional Programmer's Guide to Fortran 77, by Clive Page, see http://www.star.le.ac.uk/~cgp/fortran.html.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page