The above instructions for one-time-configuration of visual studio have not been updated for the latest versions of visual studio (2019) or for Intel fortran Version 2020 (in folder C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020.1.216).
In the Property Manager I managed to find the include and library folders (under an item called Upgrade from VC such and such), and added the intel items using $(IFORT_COMPILER20)\compiler.... But after doing control-S to save, exiting visual studio triggered error messages that the property changes could not be saved.
So I tried launching visual studio with admin rights, and tried again (the changes just made were gone). I still got error messages about things not being saved when closing the C Calls Fortran solution, and also when closing visual studio.
When restarting visual studio normally, C Calls Fortran has evidently been corrupted and will no longer load.
C:\Users\Cheers\Documents\Visual Studio 2019\Projects\Samples compiler_f\MixedLanguage\C_calls_Fortran\USEDLL\msvs\USEDLL.vcxproj : error : The imported project file "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CPP.UpgradeFromVC71.props" could not be loaded. Root element is missing. C:\Users\Cheers\Documents\Visual Studio 2019\Projects\Samples compiler_f\MixedLanguage\C_calls_Fortran\USEDLL\msvs\USEDLL.vcxproj C:\Users\Cheers\Documents\Visual Studio 2019\Projects\Samples compiler_f\MixedLanguage\C_calls_Fortran\USELIB\msvs\USELIB.vcxproj : error : The imported project file "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CPP.UpgradeFromVC71.props" could not be loaded. Root element is missing. C:\Users\Cheers\Documents\Visual Studio 2019\Projects\Samples compiler_f\MixedLanguage\C_calls_Fortran\USELIB\msvs\USELIB.vcxproj
How do I fix this?
I am trying to restore the C Calls Fortran sample project, but I don't remember where I got it from, and I cannot find it anywhere on my system. Where can I get/find this?
It is quite difficult now to find the samples! Sorry about that, I'll see why the web folks are making things harder to find. Here is a link to the Windows PSXE 2020 Samples bundle including the Fortran samples, which include the mixed language sample:
Great - the FAQ link https://software.intel.com/en-us/product-code-samples is broken. My opinion of this ongoing attempt to frustrate users is unprintable. (Oh, and users here can't find the FAQ anymore since the link to it was removed when the new forum went live.)
Thanks for the link to the samples. I actually had that file already downloaded but didn't know the name of it.
However, more important than just downloading the samples is being able to configure visual studio 2019 & intel fortran 2020 to work with the samples.
Please tell me how to do that.
One thing I observed during my failed attempt at that was the LIB directories for ia32 and intel64 could not both be assigned independently. Assigning one would overwrite the setting of the other.
The instructions in the article, other than not referencing VS2019 and COMPILER20, are correct. I'm wondering if you somehow prevented VS from loading the C++ projects when you opened the solution, triggering the other errors. I just went through these steps myself and it worked fine.
I suggest you start over and pay attention to messages that pop up.
I got stuck where step 3 says Double click on Microsoft.Cpp.Win32.user because it's not there.
I am unable to start over. I tried by deleting the C Calls Fortran Project folder, and restored it from the zip file download. When I open the .sln project, visual studio has trouble with it. See attached screen shot.
I managed to fix visual studio. I found C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.UpgradeFromVC71.props and it was empty. I replaced it with a copy of Microsoft.Cpp.UpgradeFromVC70.props with all the occurrences of 70 replaced with 71.
Now C Calls Fortran sln opens normally, but I still can't follow the visual studio configuration instructions. The screen shot below shows that Microsoft.Cpp.Win32.user is missing. There must be something different about my visual studio and/or computer.
If I double click Upgrade from VC 7.1 (a strange name for a property page), there are Include and Library directories which I can edit, but the changes fail to save, as well as there is an obvious incompatibility between 32 bit and 64 bit property settings for the Library directory.
I have managed to work around the problem by adding the intel compiler Include and Library directories at the sln project level.
Steve - if you want to do a screen share and see the errors, email me at bmurphy at xlrotor.com and the Windows 10 Quick Assist tool should make that easy.
That isn't the correct property page. I suggest that you reinstall Visual Studio, including Visual C++ for Desktop Applications. Something is wrong with your VS (not Intel Parallel Studio) install.
When I installed VS (that was in March), I don't remember making any selections regarding Visual C++ for Desktop Applications. I'll be on the lookout for it.
The visual studio community installer says I already have Visual C++ for Desktop Applications installed.
Maybe the Community version of visual studio can't be configured to include the Intel folders.
I am using the Community Edition - works fine for me. I just tested it - created a C++ Console project, brought up the Property Manager (had to go to View > Other Windows > Property Manager), and there it was.
There is an obvious mistake I think in the sample Intel Code
Fortran Calling Sequence Example use, intrinsic :: ISO_C_BINDING, only: C_INT, C_FLOAT, C_LOC use ftn_C_2 ... real (C_FLOAT), target :: send(100) integer (C_INT) :: sendcount integer (C_INT), ALLOCATABLE, target :: recvcounts(100) ... ALLOCATE( recvcounts(100) ) ... call C_Library_Function(C_LOC(send), sendcount, & C_LOC(recvcounts)) ...
Steve: I am a bit lost, there are quite a few posts.
That sample of code I put up is from your manual on the Intel website for C to Fortran programming, i tried it but it did not work , they missed a : for the 100 in the first allocate statement.
To say the Intel Web site is an interesting mess is to disparage the people who live in messes because they are forced to - Garbage scavengers springs to mind, Intel chooses to be this bad.
I am well aware it is not your manual, I am well aware of how much time and effort you put into this site and I am aware that you are a living legend in Fortran. I really appreciate all of your assistance.
This is the new online 19.1 Reference Manual -- the samples have a minor error, just interesting rather than anything else.
I am also slowly going under with three new online classes. --
Thanks for the pointer to the manual example. There are two and a half errors, none of which are in the ALLOCATE statement.
1. I think what you meant to say was that the declaration of the allocatable variable recvcounts should say (:) instead of (100).
2. The C function, declared as a function in Fortran, is called as a subroutine.
2.5 - The BIND (C, NAME=) uses a character other than apostrophe for the end delimiter.
I'll report this to Intel.