- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am experiencing some difficulties in generating an .exe file from a Fortran 77 code. I am running VS Community 2019 on Windows 10. I installed the 'Intel Fortran Compiler (Beta) & Intel Fortran Compiler Classic'.
I am new to Fortran (and compiled languages), and I am a structural engineering, so please apologize some basic errors I might be doing.
The steps to reproduce my problem are as follows:
1) Launch VS and create new empty project on a local folder C:\Users\USER\Workspaces\Fortran
2) Project > Add New Item > Fortran Fixed-form File (.for), which creates Source1.for visible on the Solution Explorer under Source Files.
3) Copy+Paste sample code (it creates and populates a new file data1.dat with some data).
4) Ctrl+S > Build > Build Solution
The Build is successful but the data1.dat is not created and I cannot run Debug\Console1.exe (System Error: The code execution cannot proceed because libmmdd.dll was not found. Reinstalling the program may fix this problem).
Is this a matter of reinstalling VS (or the compiler?) or am I doing something wrong? Perhaps I did not download the right Intel product?
I attached a .zip with the project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Problem solved: in Project > Properties > Cinfig Properties > Fortran > Libraries > Runtime Library, I changed from Multithread DLL (/libs:dll /threads) to Debug Multithreaded (/libs:static /threads /dbglibs). Then the .exe file runs normally and generates the intended file.
I hope for my (basic) use of VS this does not have collateral effects.
EDIT: see @Steve_Lionel 's warning regarding side effects.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The environment is probably not configured for Fortran. Try the following steps.
Open an Intel Fortran/OneAPi command window from the Windows Start menu. Enter the command "devenv" in that command window. Visual Studio will come up. Open your solution and you can do the steps of building, debugging, etc.
The EXE in your Zip ran normally and produced the data1.dat file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@mecej4 , aren't your steps equivalent to what I did in my question? I opened VS using the command prompt and did Build Solution, bu still the .exe file that appears in the Debug folder does not run.
How do I configure the environment for Fortran as you say?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you running the program from inside Visual Studio, or separately? Debug-configuration builds will not run outside the Visual Studio environment because the debug DLLs are not added to PATH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Steve_Lionel if I understood your point, then no, I'm not running the .exe file from within VS (i.e., I'm double-clicking on the .exe file that is generated into the Debug folder once I press Build Solution). If this does not work, how can I generate an .exe file that can be invoked from other programs (my main program is written in Python and I want to call some Fortran 77 routines)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
JSerra wrote, "I'm double-clicking on the .exe file that is generated into the Debug folder once I press Build Solution".
That explains why things don't work. When you double click the icon of an EXE file, you are inheriting the default environment of any EXE on your system, and that one is probably not configured to run EXEs that depend on the Intel OneAPI runtime libraries.
You can (i) modify the system PATH (not recommended, has side effects that may be unexpected and undesirable), (ii) specify in Visual Studio that the path to the OneAPI RTL DLLs should be added to PATH, or (iii) run the EXE using the IFort command window.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The recommended solution is to build a Release configuration executable. In your VS project, click on the Configuration option (highlighted) and change to Release. If you made any changes to project properties, you'll have to repeat them.
I don't recommend @mecej4 's suggestions. A Release configuration will use DLLs available through the system PATH environment variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Even with the Release x64 option I cannot run the .exe file (same error pops-up). Am I doing steps 1-4 correctly (now selecting Release before building)? Is the type of project (Empty Project) correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To use your option (ii), how do I find out where the DLLS are? I didn't get any .dll in my directory.
Is the correct way adding PATH=%PATH%;$(ProjectDir)\some-framework\lib (ipsis verbis?) to Project > Properties > Conf Properties > Debugging > Environment as explained here ? (if so, it is still not working - I cannot run the .exe by double-clicking on it).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you sure it's the same error when you build in release mode? The one you showed before was for a debug DLL.
Please do not mess with PATH - that's unnecessary and possibly harmful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
(PATH is now restored to default.)
I am doing steps 1-3 and step 4 is now:
4) Ctrl+S, select Release x64 (x86 is default not sure why), and then Build > Build Solution (do I need to Compile first?)
Then, a new folder named as "x64" appears within the project folder, containing Console1.exe. If I double-click on it, the same error (as when I was running the Debug option) pops up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's not exactly the same error - note that the file name of the DLL is subtly different. The Debug configuration wanted libifcoremdd.dll, the release configuration is looking for libifcoremd.dll.
I suggest that you uninstall and reinstall the oneAPI HPC Toolkit. libifcoremd.dll (one d) should be installed in a common location that is added to PATH by the install. Before doing this you may want to log out of Windows and in again - sometimes I find that this fixes issues with new additions to PATH.
Build Solution does a compile if necessary. It's what you would normally use, rather than a separate Compile.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>If I double-click on it...
That means: run the .exe using the environment variables currently in use by the Windows (File) Explorer. These setting are not necessarily the same environment variables as use (required) by the development system.
A "simple" hack you can do, assuming you want to use Windows (File) Explorer to launch your application is to first (sometime once per boot), is to launch the Intel Parallel Studio (or oneAPI) x64 command prompt, type in "explorer" (no quotes). This will a) set the environment variables for Intel development/runtime, b) launch Windows (file) Explorer with the proper environment.
Now you can browse and double click on your .exe(s).
Note, you can close the CMD window *** but I suggest you only minimize the Windows (file) Explorer for future use.
Also note, the Current Directory (and current Drive) are that of Windows (file) Explorer as launched and not (necessarily) that of the .exe.
There are similar methods to do this, you just have to be creative.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Problem solved: in Project > Properties > Cinfig Properties > Fortran > Libraries > Runtime Library, I changed from Multithread DLL (/libs:dll /threads) to Debug Multithreaded (/libs:static /threads /dbglibs). Then the .exe file runs normally and generates the intended file.
I hope for my (basic) use of VS this does not have collateral effects.
EDIT: see @Steve_Lionel 's warning regarding side effects.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, that is certainly one way to work around the issue, but I hope others reading this don't assume it is the best solution. You have something wrong with your installation and should repeat the install. There are several problems with this choice, including "baking in" to your EXE any bugs that may be in the support libraries, and making your EXEs much larger and consume more RAM than they would otherwise.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have reinstalled the Intel® Fortran Compiler Classic and Intel Fortran Compiler(Beta) (now running release 2021.3, before 2021.2) and followed your tip on restarting Windows. Still getting the same error(s).
Should I install the HPC Toolkit instead? (I was avoiding it due to its size on disk.) Is the libifcoremd.dll (one d) installed during the same installation or do I have to do it manually?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh, I forgot about this! You have to install the run-time DLLs separately. This is something Intel did in the oneAPI version that was never needed before. Worse, Intel never tells you that this is necessary. Go to Intel® oneAPI standalone component installation files , select Runtime Versions > Windows > Intel Fortran Compiler Runtime for Windows.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for this information Steve. This completely solved my problem.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page