Topic: fortran 77
Is it possible to debug programs written in Fortran 77 in simply fortran? if it is possible, should I specify additional parameters when installing the software?
For discussions of all Approximatrix products and related software
You are not logged in. Please login or register.
Approximatrix Forums → User Support → fortran 77
Is it possible to debug programs written in Fortran 77 in simply fortran? if it is possible, should I specify additional parameters when installing the software?
Yes, you can debug Fortran 77 code in Simply Fortran on Windows, Linux, and Intel macOS. There aren't any steps other than installing the software. It should "just work."
Yes, you can debug Fortran 77 code in Simply Fortran on Windows, Linux, and Intel macOS. There aren't any steps other than installing the software. It should "just work."
Thanks Jeff for your kind reply. I followed your feedback that Fortran 77 It should "just work" and as a test I ran the file "TEST.FOR" in 'Simple Fortran', which is located on my computer in the D:\ directory and which contains the following simple code, on Fortran 77:
SUBROUTINE TEST(INEW,IOLD,NEQ)
DIMENSION INEW(1),IOLD(1)
NN=NEQ+1
DO 10 I=1,NN
10 INEW(I)=IOLD(I)
RETURN
END
and in response I received this message from 'Simple Fortran':
This“Compiling D:\TEST.FOR
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
D:\TEST.FOR:5:72:
5 | 10 INEW(I)=IOLD(I)
| 1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 10 at (1)
Generating D:\TEST.exe
c:/program files (x86)/simply fortran 3/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/lib/../lib\libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
Error: Last command making (D:\TEST.exe) returned a bad status
Error: Make execution terminated”
What does it mean ? Do I have another Fortran 2018 compiler installed that conflicts with 'Simple Fortran', or is it built into 'Simple Fortran' itself?
How to resolve this conflict, so that I can debug Fortran 77 programs without crashing ?
I have installed some softwares related to Fortran to integrate it into matlab using mex files, which is the ultimate goal of my endeavors, can one of these programs perceive "Simple Fortran" as "Fortran 2018"?
The first message you receive with this code is a warning that, as of Fortran 2018, having the DO loop end on anything other than a CONTINUE statement is no longer allowed. However, the compiler is warning you that it is a deleted feature but not enforcing the new standard; the code still compiled. If you don't want to see these types of messages, you can enable the "legacy" standard in Project Options under "Fortran."
The final error, though, is because your code is just a subroutine, and no program has been included. You would need to add a program for this code to actually do anything.
Simply Fortran includes a compiler. There is nothing else to install.
There are about 100 files on the D: / drive of the computer, with the extension .FOR, in which subroutines are written in the Fortran77 language. One of the files contains the main program. Some of these routines are called from each other and pass variables to each other.
How to create a single executable file from these files using Simly Fortran, how to debug the created file in a single context and how to run it?
I'm new to Simply fortran, I searched the documentation for a solution to my problem for a long time, but nothing came of it.
You would need to place all the Fortran source files in a "project" in Simply Fortran to build the executable. With all the files in one project, Simply Fortran will compile each to object code, one by one, and link these into a single executable.
You could manually add the files to a project (from the Project menu), but in this case, the simplest route would be:
Select "New Project..." from the Project menu
From the Select New Project window, choose "Import..." to import a directory of source code
Select the directory with all your source files and click Ok
Save your project using "Save Project" in the Project menu
I would strongly suggest saving the project in the same directory as all the source files. Now, when you select "Build Project" from the Build menu, it should compile everything and link an executable unless, of course, there are errors.
Hello dear jeff. I am sincerely grateful to you for such exhaustive and kind answers given to me on the topic of the forum that I created. I couldn't do it without you, to learn more about the wonderful and simple "Simly Fortran" interface.
I have one question for you: Is it possible to create a mex file from the whole Fortran 77 project in "Simly Fortran" for further integration into Matlab?
Possible to create a mex file? Yes. Trivial? No, far from it...
To build a mex file, you really need to use MATLAB's commands to do so since they contain paths to the necessary libraries for linking. MATLAB should support our compiler since R2015, but setting it up won't be pleasant. It looks like they have some guidance on configuring the MinGW-w64 compilers if already installed.
When I run the fortran 77 project executable in simply fortran, all input and output appear in the "Console" window.
Is it possible in Fortran 77, after completing all processes, to open a text file with the extension .CSV or .TXT, which is located in the same directory and write
in it all the contents of the "Console" and save it.
Of course, I can manually copy the contents of "Console" into a text file, but I need Fortran itself to do this programmatically.
I would normally suggest actually opening a file and writing everything you need to it. Alternatively, you can redirect the program output to a file, which is possible through the Project Options in the Launch category using arguments, something like:
> output.txt
but the above means you wouldn't see the output in the Console tab as well.
You can actually save the Console tab contents directly, but, by default, Simply Fortran prevents it to avoid confusion. In the Appearance and Behavior Options under the "Tab Behavior" category, you can uncheck the option labeled "Disable Saving of Build Status / Console Tabs." Now File->Save should just save the Console tab as a text file when requested. This behavior is normally disabled because a lot of users thought they were saving their Fortran code when the Console tab was the "current" tab with keyboard focus.
Also, just so you're aware, Simply Fortran just creates a standard Windows executable in your project directory. You could just run the program from the Windows command prompt too. That usually makes redirecting output significantly easier.
I call the executable file 'target.exe' from matlab using the command 'system('target -e /path_to_fortran_code/my_fortran_executable my_fortran_args &');' and the entire contents of the Console are displayed in the C:\WINDOWSSYSTEM32\cmd window, but I want it to be displayed in a text file for further processing in Matlab
The MATLAB documentation says you can simply capture program output:
[status,cmdout] = system(command) also returns the output of the command to cmdout. This syntax is most useful for commands that do not require user input, such as dir.
[status,cmdout] = system(command,'-echo') also displays (echoes) the command output in the MATLAB Command Window. This syntax is most useful for commands that require user input and that run correctly in the MATLAB Command Window.
I would suggest just handling things on MATLAB's side.
Approximatrix Forums → User Support → fortran 77
Powered by PunBB, supported by Informer Technologies, Inc.