- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to Compile a 1980's Fortran Code a friend wrote and having trouble with entering a filename. He opens unit 1 as 'CON' with this statement: OPEN (1,FILE='CON') and does some error checking. I'm thinking he meant CONSOLE
I'm trying to compile as an x86 in Visual Studio and eventually I wanted to add Fortan_WinPrint and maybe try to figure out how to use GetOpenFileName to let the user pick a filename instead of having to type a name at a DOS prompt.
I got it to compile but when I try to type in the filename, I get an error that it can't read or something.
The ancient FOR file is attached and I commented out all the old JCL commands.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"CON" is one of the magic file names under MS DOS. Others are "PRN" and "NUL". And there were a few more, if I am not mistaken. "CON" is indeed the console. It is much better to write that as "READ(*,'(A)') FLNAME".
Oh, the code also uses control characters that will not work anymore, a "+" in the first column. It used to work specifically on printers.
Link Copied
- « Previous
-
- 1
- 2
- Next »
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jim;
If you just hit a CR when it asks for the PYCURVE and E, it will default to a value he had in the FOR program.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does the following program run or fail?
program Console15
implicit none
character(20) :: INFILE
print *, 'Enter something'
read(*,'(A)') INFILE
print *, INFILE
end program Console15
That is a .f90 free form file name.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>The message says to see the Visual C++ docs but I'm wondering why it is a C++ problem since I'm using the Fortran compiler.
Fortran uses many of the C Runtime Library routines. Windows is build on that (so is Linux). I/O is performed by the operating system which is written in C/C++/assembler.
Also, you might want to check the MS VS Output Window (look for tab in the IDE) to see where the C runtime libraries are coming from.
On my sytem:
Output Window
'Console15.exe' (Win32): Loaded 'C:\Users\Jim\Source\Repos\Console15\Console15\Debug\Console15.exe'. Symbols loaded.
'Console15.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'.
'Console15.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'.
'Console15.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'.
'Console15.exe' (Win32): Loaded 'C:\Program Files\AVAST Software\Avast\x86\aswhook.dll'.
'Console15.exe' (Win32): Loaded 'C:\Windows\SysWOW64\apphelp.dll'.
'Console15.exe' (Win32): Loaded 'C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020.0.166\windows\redist\ia32_win\compiler\libifcoremdd.dll'. Module was built without symbols.
'Console15.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imagehlp.dll'.
'Console15.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbase.dll'.
'Console15.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'.
'Console15.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'.
'Console15.exe' (Win32): Loaded 'C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020.0.166\windows\redist\ia32_win\compiler\libmmd.dll'. Symbols loaded.
The program '[23212] Console15.exe' has exited with code 0 (0x0).
If you get something other than those in the SysWOW64 (for x86 build) or System32 (for x64 build), then the wrong version of the CRTL was being loaded.
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is the same problem listed here. Though the OP was using QuickWin.
Barbra_P_Intel suggested to download oneAPI (Base Kit and HPC Kit). The Base Kit has the C/C++ code and is a prerequisite for the HPC Kit that contains the Fortran code.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I get the same darn error with your simple Hello World code. I just started a new project and opened the F90 file as a source.
I've used this same VS17 interface to write some programs (with Arjen's help) to read an XML file and parse the data and design a base plate for a steel pole, so I'm wondering what went wrong in the last week or so.
I guess I'll try VS22 and see if that works. I looked on my C: drive and found these Fortran update files:
c:\Software-Install-Files\Fortran\parallel_studio_xe_2019_update5_composer_edition_for_fortran_setup.exe
c:\Temp\parallel_studio_xe_2018_update2_composer_edition_for_fortran_online_setup.exe
c:\Temp\parallel_studio_xe_2018_update4_composer_edition_for_fortran_online_setup.exe
c:\Users\00000414\Downloads\Intel\parallel_studio_xe_2019_update6_composer_edition_for_fortran_online_setup.exe
c:\Users\00000414\Downloads\Intel\parallel_studio_xe_2020_update2_composer_edition_for_fortran_online_setup.exe
c:\Users\00000414\Downloads\parallel_studio_xe_2020_composer_edition_for_fortran_setup.exe
c:\Users\00000414\Downloads\parallel_studio_xe_2020_update1_composer_edition_for_fortran_setup.exe
c:\Users\00000414\Downloads\parallel_studio_xe_2020_update4_composer_edition_for_fortran_setup.exe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do a "clean" and the a "full build" and post the buildlog.html file. We can then see the project type and option etc. In suspect there is some problem in the project settings.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, here is the HTM:
Compiling with Intel® Fortran Compiler Classic 2021.5.0 [Intel(R) 64]... ifort /nologo /debug:full /Od /warn:interfaces /module:"x64\Debug\\" /object:"x64\Debug\\" /Fd"x64\Debug\vc170.pdb" /traceback /check:bounds /check:stack /libs:qwin /dbglibs /c /Qlocation,link,"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX64\x64" /Qm64 "J:\Apps\PLS\POST\DPA\test.F90" Linking... Link /OUT:"x64\Debug\QWin2.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"x64\Debug\QWin2.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\00000414\source\repos\QWin2\QWin2\x64\Debug\QWin2.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"C:\Users\00000414\source\repos\QWin2\QWin2\x64\Debug\QWin2.lib" -qm64 "x64\Debug\test.obj" Embedding manifest... mt.exe /nologo /outputresource:"C:\Users\00000414\source\repos\QWin2\QWin2\x64\Debug\QWin2.exe;#1" /manifest "x64\Debug\QWin2.exe.intermediate.manifest"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
From that I can see your project is being build as a Quickwin project type. The program you showed looks like is should be a console project. I would create a new (empty) console project in VS and add your source files to it and then try that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello andrew;
OK, that worked and it ran the Console15 Code that Jim gave fine without error.
My dilemma is I have this old .FOR Code that I want to modernize somewhat. I've used the Fortran_WinPrint.F90 in several programs I wrote 30 years ago to be able to print output to a Windows Printer or PDF. I would also like to clean up the inputting of file names by selecting a file in a Dialog Window and pass the filename to this old .FOR routine. I believe there is a F90 routine that will do it.
Given those wishes, what would be the best solution type to start with? I was using the x86 to do my SLN and editing .F90 and .FOR files to do the number crunching. I don't envision doing much or any graphic output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well sending things to printers is very "old school' these days. If you output is only text you may as well just create text files you can always print those from windows rather the from the application. You will need quite a bit of time and learning to get a Windows Application or even a simpler QuickWin application set up for maybe not much real gain.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Dr Fortran;
I was hoping I would see you stop in and add something. If I can ever get this old .FOR to compile and run, I was going to try to use that getopenfilename code to prompt the user to input a file name. My next task is to get an OUTPUT filename where the user would type in a name and then there are a couple of default real number parameters that are needed. The existing code asks for a number and if the answer is blank or nul, he assigns the default. Someone else wrote this .FOR so I'm not sure what he was doing.
I was thinking I could make this DPA4r1.FOR as a subroutine and write a Main to call getopenfilename and pass the result to the old .FOR code and delete all his reading from the Console. IIRC, there is a Saveopenfilename that I read about?
My dilemma is which Solution Type should I use? The QuickWin gives the error I've been chasing all week and I thought I have been using the x86 or x64 but they get the error reading the input file too.
I'm heading for the bus home in a couple of minutes so I won't be able to test anything until morning in Houston, Tx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is GetSaveFileName - it works just like GetOpenFileName. You will want to use Fortran Console Application as the project type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many Thanks to all that helped. I was able to do as Dr. Fortran said and start a new solution (I am a novice in VS and can barely navigate it) as a Fortran Console and added the old .FOR file plus the winprint F90 (have not tried it yet).
It compiled and I was able to get it to run. (Finally!)
My next task is to use the GetOpenFileName code to work instead of having the user type in a filename, but I will start a new thread for that.
![](/skins/images/B7BA37F9CE4B52FF7CAE1FB0388839C8/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- « Previous
-
- 1
- 2
- Next »