- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi everybody! I like make a question of curiosity. I normaly do the comments in fortran 95/90 with "!", but I read in Intel Fortran Programmers Reference that I can create a comment with "C or c",with "*" and with "#", but I try in hola.f90, and I get the following errors:
Estoy compilando, tardo un ratn...
hola.f90(2): error #5082: Syntax error, found IDENTIFIER 'THIS' when expecting one of: ( % [ : . = =>
C THIS IS A COMMENT
--^
hola.f90(3): error #5082: Syntax error, found '*' when expecting one of:
Estoy compilando, tardo un ratn...
hola.f90(2): error #5082: Syntax error, found IDENTIFIER 'THIS' when expecting one of: ( % [ : . = =>
C THIS IS A COMMENT
--^
hola.f90(3): error #5082: Syntax error, found '*' when expecting one of:
1 解決策
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Please do not use -fixed or -free. Instead, rename the source file to have the .f90 file type if it is free-form source, or .f or .for if it is fixed-form source.
You misunderstood the documentation - the part where it talks about C as a comment delimiter is in the section for fixed-form source specifically.
I strongly recommend the use of free-form source in all new development.
You misunderstood the documentation - the part where it talks about C as a comment delimiter is in the section for fixed-form source specifically.
I strongly recommend the use of free-form source in all new development.
コピーされたリンク
10 返答(返信)
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
The .f90 extension (and .f95, .f2k, .f03, .f08, ...) is usually associated to free-form source files, and therefore only "!" is allowed to indicate the beginning of a comment (anywhere between columns 1 and 132).
The fixed-form source files (which usually have extensions .f, .for, .f77, .ftn, ...) allow "C" or "*" but only in the first column. Fixed-form files also allow "!" anywhere between columns 1 and 5 and between columns 7 and 72.
The compiler will let you put "!" after column 132 (in free-form) or after column 73 (in fixed form), but some extra flags might be required and it's not a portable solution.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
I was surprised it did not work because I read in the guide intel fortran. It's a shame, because I would have liked to reuse code that I have on. for or. f77 and change them. f90.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
If you want to use fixed form input with .f90 file name, there is an option for that, but the usual way is to continue to use those file names with .f or .for suffixes.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Thanks for yor response! which is this option? But, Is possilble the I using the fortran 90 options and I name as .for? Thanks
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
I think that you can use -fixed and -free options to specifically tell the compiler that the program is Fixed Form (F77 style) and Free Form (F90 and later) respectively. Unless I am missing something, these options will override the extension of the filename.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Ok, then I must add in the makefile in the line:
FFLAGS=-openmp -O3 -traceback
the option -fixe or free?:
FFLAGS=-openmp -O3 -traceback -fixed
Thanks for your help
Regards
FFLAGS=-openmp -O3 -traceback
the option -fixe or free?:
FFLAGS=-openmp -O3 -traceback -fixed
Thanks for your help
Regards
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
You should add -fixed in the makefile. This will enable a .f90 file to be treated in fixed form. In other words, your original code should work without the syntax error with this option.
Best!
-Udit
Best!
-Udit
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
The ! form of comments will work regardless of fixed or free format.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Please do not use -fixed or -free. Instead, rename the source file to have the .f90 file type if it is free-form source, or .f or .for if it is fixed-form source.
You misunderstood the documentation - the part where it talks about C as a comment delimiter is in the section for fixed-form source specifically.
I strongly recommend the use of free-form source in all new development.
You misunderstood the documentation - the part where it talks about C as a comment delimiter is in the section for fixed-form source specifically.
I strongly recommend the use of free-form source in all new development.