Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28471 Discussions

C calling Fortran example, can't configure visual studio

Brian_Murphy
New Contributor II
4,516 Views

https://software.intel.com/content/www/us/en/develop/articles/configuring-visual-studio-for-mixed-language-applications.html

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.  

Image 41.pngImage 42.png

When restarting visual studio normally, C Calls Fortran has evidently been corrupted and will no longer load.

Image 44.pngImage 43.png

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?

0 Kudos
29 Replies
Brian_Murphy
New Contributor II
1,613 Views

I did the same thing, and got this:

Image 2.pngI also just noticed that when I open the C Calls Fortran sample solution, visual studio logs the following message in the Output window.

C:\Users\Cheers\Documents\Visual Studio 2019\Projects\Samples compiler_f\MixedLanguage\C_calls_Fortran\USEDLL\msvs\USEDLL.vcxproj : warning : The build tools for Visual Studio 2013 (v120) cannot be found. To build using the Visual Studio 2019 (v142) build tools, either click the Project menu or right-click the solution, and then select "Retarget Solution". Install Visual Studio 2013 (v120) to build using the Visual Studio 2013 (v120) build tools.

I did the retarget thing, but the Property Manager still shows Upgrade from VC 7.1 in place of Microsoft.Cpp.Win32.user.

I will uninstall visual studio and start over.

0 Kudos
JohnNichols
Valued Contributor III
1,609 Views

These are the latest samples from Intel -- it is in there - and they are dashed hard to find

The file (ipsxe2019-samples-win-20190327.zip) exceeds the maximum file size. The maximum file size is 71 MB.

Here is the part I used 

0 Kudos
JohnNichols
Valued Contributor III
1,606 Views

Install VS 2017 - it is the last one that works with C++ without hunting for old versions, 

works a treat. 

0 Kudos
Brian_Murphy
New Contributor II
1,502 Views

John - what do you mean by vs2017 works with C++ without hunting for old versions.

I went from vs2010 to vs2019.  I really like a lot of 2019's features.

I have a license for Intel C++, but am using Microsoft's.

0 Kudos
JohnNichols
Valued Contributor III
1,495 Views

Intel C++ requires a version of VS 2019 that is released before the build date on the C++ compiler or you get some really weird errors and Intel just tells you to go back a steps in the VS version, which is a pain. I run the latest VS Preview, very rarely does Intel Fortran have a problem with the latest VS Preview or even the Windows preview, it did about three months ago for a few weeks, the annoyances are worth the bleeding edge.  But for the Baker program is just easier to run vs 2017 and avoid errors. 

Compared to 2017  - 2019 is a bit better, but some things are a pain. 

0 Kudos
Brian_Murphy
New Contributor II
1,522 Views

I kicked a hornets nest.

So I uninstalled visual studio.  The video studio installer application was still there, and I used it to reinstall visual studio.  It downloaded it from the web.  The following shows the state of things when I clicked Install in the lower right corner.

Image 3.png

After reinstalling, the ConsoleApplication1 I had created an hour ago would no longer load.  I don't recall the error messages.  I deleted it and made a new one.  The Property Manager before and after the reinstall of visual studio is the same.  So it looks likes the reinstall did not fix anything.

However, now none of my fortran projects will load.  I guess I will reinstall intel fortran and hope for the best.

I started the intel fortran installer, and did a repair, and that did not fix it.  I am now removing intel fortran.

I am editing this post as I go along.  I have now reinstalled intel fortran, and at the same time moved from Upgrade 1 to Upgrade 2.  Intel® Visual Fortran Compiler – extension version 19.1.0057.16, Package ID: w_comp_lib_2020.2.254.  Things seem to be back normal.  Whew!

0 Kudos
JohnNichols
Valued Contributor III
1,518 Views

have a look at the videos of the guy who goes all over the world actually getting things to bite him and then screaming in pain for a few hours

Reminds me of learning Fortran in 1978 with a daemon computer with a card reader and a printer in the library - one for the whole uni. 

0 Kudos
Brian_Murphy
New Contributor II
1,510 Views

I got you beat, but just barely.  1975 give or take a year, using paper tape.  The instructor teaching my first and only fortran class was also just learning it.  Those were the days.

0 Kudos
JohnNichols
Valued Contributor III
1,497 Views

Not beaten - tied, in 1975 I started applied math at ANU, the first assignment was Fortran Format statements, I changed to Psychology - third worst mistake of my life. 

0 Kudos
Reply