- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Morning,
The programs I'm involved with are run from a command prompt using list-directed input and output, i.e. one would type
ProgramNameOutputFile.txt
and press Return. In CVF, this could be replicated by entering 'OutputFile.txt' in Program arguments under the Debug tab of the Project settings.
In Intel Visual Fortran, I've tried to do the same thing by placing the same text in the Command Arguments entry in the Debugging tab of the Project Properties, but to no avail. I've tried including the full paths with the file names and also removing < and >, again to no avail.
Any help that anybody can provide would be greatly appreciated.
Adam
The programs I'm involved with are run from a command prompt using list-directed input and output, i.e. one would type
ProgramName
and press Return. In CVF, this could be replicated by entering '
In Intel Visual Fortran, I've tried to do the same thing by placing the same text in the Command Arguments entry in the Debugging tab of the Project Properties, but to no avail. I've tried including the full paths with the file names and also removing < and >, again to no avail.
Any help that anybody can provide would be greatly appreciated.
Adam
Link Copied
9 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you specify the working directory in the Project->Properties->Configuration Properties->Debugging window?
With that done, so that the target .exe can find the input file, it worked for me.
"I've tried including the full paths with the file names and also removing < and >, again to no avail." -- that should not work! Fortran programs do not parse command arguments without some explicit coding on your part for that purpose. Since the .exe file is built to read from and write to the console device, that is what it will do, and whatever command arguments you give will be ignored.
Use the GETARG subroutine or use the F2003 GET_COMMAND_ARGUMENT subroutine if you want to process command arguments.
With that done, so that the target .exe can find the input file, it worked for me.
"I've tried including the full paths with the file names and also removing < and >, again to no avail." -- that should not work! Fortran programs do not parse command arguments without some explicit coding on your part for that purpose. Since the .exe file is built to read from and write to the console device, that is what it will do, and whatever command arguments you give will be ignored.
Use the GETARG subroutine or use the F2003 GET_COMMAND_ARGUMENT subroutine if you want to process command arguments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which VS version are you using? I recall that VS2005 had some problems with this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the replies. I'm using VS2008.
I have specified the working directory in the project properties, but still no joy I'm afraid. I've tried a few different programs as well.
Are there any other settings I should be looking at?
Thanks,
Adam
I have specified the working directory in the project properties, but still no joy I'm afraid. I've tried a few different programs as well.
Are there any other settings I should be looking at?
Thanks,
Adam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm still no further forward with this. Here is a screenshot of the Project Settings:

And here is one showing the location of the specified input file:

Any further assistance that anybody is able to provide would be much appreciated.
Regards,
Adam

And here is one showing the location of the specified input file:

Any further assistance that anybody is able to provide would be much appreciated.
Regards,
Adam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here are my 2c, although I did not verify it myself.
"Operators" < and > are used for standard input and output redirection (thus, have nothing to do with "list-directed", which is a Fortran term). Now, strictly speaking, the redirection is a command of command line interpreter (cmd.exe) and may not work automatically in other programs. Visual Studio possibly executes the console program directly (not throuth cmd.exe) and thus the redirection symbols may not work as expected.
Here Steve mentioned that the feature sort of works in Visual Studio, but for some reason you have to specify full paths to the input and output files (D:\ACQ\...\Ex1.inp).
Alternatively, you may try to invoke cmd.exe by setting:
Command: cmd.exe
Command arguments: /C $(TargetPath)Ex1.out
"Operators" < and > are used for standard input and output redirection (thus, have nothing to do with "list-directed", which is a Fortran term). Now, strictly speaking, the redirection is a command of command line interpreter (cmd.exe) and may not work automatically in other programs. Visual Studio possibly executes the console program directly (not throuth cmd.exe) and thus the redirection symbols may not work as expected.
Here Steve mentioned that the feature sort of works in Visual Studio, but for some reason you have to specify full paths to the input and output files (D:\ACQ\...\Ex1.inp).
Alternatively, you may try to invoke cmd.exe by setting:
Command: cmd.exe
Command arguments: /C $(TargetPath)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jugoslav - your second suggestion allows the program to be run from MS VS when the full paths to the files are included.
However, it gives rise to the message "Debugging information for 'cmd.exe' cannot be found or does not match. Symbols not loaded." and the program exits with code 0 (0x0) and one cannot do any actual debugging, e.g. breakpoints cannot be used/have no effect etc.
I seem to remember seeing the message 'No matching symbolic information found' or something similar in CVF 6.6, but it didn't seem to cause any problems so I ignored it. Do the messages correspond to one another?
Thanks for the help so far - appreciated.
Regards,
Adam
However, it gives rise to the message "Debugging information for 'cmd.exe' cannot be found or does not match. Symbols not loaded." and the program exits with code 0 (0x0) and one cannot do any actual debugging, e.g. breakpoints cannot be used/have no effect etc.
I seem to remember seeing the message 'No matching symbolic information found' or something similar in CVF 6.6, but it didn't seem to cause any problems so I ignored it. Do the messages correspond to one another?
Thanks for the help so far - appreciated.
Regards,
Adam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It seems you are losing the correspondence with the debug information. Have you tried using the full path names (Jugoslav's first suggestion)?
------
Wendy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Now that you say it, it is quite natural that you cannot debug it, so my suggestion was a dead end, sorry. If foo.exe launches bar.exe, you cannot debug the latter by specifying the former as the executable. They don't share the address space. You might Debug/Attach to process, but that's a cludge.
Have you tried the full paths to source files instead?
Have you tried the full paths to source files instead?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Two suggestions:
- If you haven't already, install SP1 for VS2008, which apparently fixes this - see here.
- Write a little debug function that does the redirection inside your program. If the first argument has the magic word then the input and output units are reconnected appropriately.
- If you haven't already, install SP1 for VS2008, which apparently fixes this - see here.
- Write a little debug function that does the redirection inside your program. If the first argument has the magic word then the input and output units are reconnected appropriately.
[fortran]! compile with /assume:noold_unit_star PROGRAM redirect_me USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY: OUTPUT_UNIT, INPUT_UNIT IMPLICIT NONE CHARACTER(LEN=5) :: command_line_arg CHARACTER(LEN=256) :: str !******* CALL debug_redirect_check READ (*, "(A)") str WRITE (*, "(A)") str CONTAINS SUBROUTINE debug_redirect_check CALL GET_COMMAND_ARGUMENT(1, command_line_arg) IF (command_line_arg == 'please') THEN ! magic debugging thing OPEN( UNIT=OUTPUT_UNIT, FILE='my_redirected_output_file.txt', & STATUS='REPLACE', ACTION='WRITE' ) OPEN( UNIT=INPUT_UNIT, FILE='my_redirected_input_file.txt', & STATUS='OLD', ACTION='READ' ) END IF END SUBROUTINE debug_redirect_check END PROGRAM redirect_me [/fortran]

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