- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there, I am using fortran 90 and compiling my .F90 file with intel-compiler/2019.5.281
My file has the following lines:
fname_lower_bound = "sevoldata" // trim(lower_bound) // ".txt"
read_file(fname_lower_bound, input_data_lower_bound, num_rows_lower_bound)
where 'lower_bound' is a string, 'read_file' is a function that reads in the file and I want to concatenate it with "sevoldata" and ".txt" to read the right text file. However, while compiling, I run into this error:
Particles_sinkStellarEvolution.F90(293): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( % [ . = =>
read_file(fname_lower_bound, input_data_lower_bound, num_rows_lower_bound)
----------------------------------------------------------------------------------^
It seems that the compiler treats '//' as a comment, because when I load the .F90 file into a text reader that can identify and format fortran code, everything from the first '//' in this line becomes a comment. I cannot change the intel-compiler as this file is a part of a much bigger code (developed for the years) that only runs with this compiler. Any suggestions for how can I successfully concatenate the file name (or tricks)?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You also have fpp option to disable C style comments:
/c_com=<yes|no> Recognize or not C style comments. Default value /c_com=yes
use /c_com=no
Jim Dempsey
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using the preprocessor option? I can imagine that the preprocessor is confusing string concatenation with C++ comment lines. The extension .F90 (instead of .f90) might be the guilty party here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your response @Arjen_Markus I renamed the file from .F90 to .f90, and I can see that the formatting doesn't show the line above as a comment after '//'. However, I include some .h files in this file early on, and changing the extension from .F90 to .f90 generates some bad preprocessor line errors:
Particles_sinkStellarEvolution.f90(36): warning #5117: Bad # preprocessor line
#include "constants.h"
-^
Is there a way to resolve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It depends a bit: is the included file a regular Fortran file that defines a number of parameters? Or is it a C-style include file, with such lines as:
#define GRAVITY 9.81
In the first case, you can use the include statement:
include 'constants.h'
In the second case, you should translate it into regular Fortran and use the include statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You also have fpp option to disable C style comments:
/c_com=<yes|no> Recognize or not C style comments. Default value /c_com=yes
use /c_com=no
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks both! Disabling C style comments worked.

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