Fortran in Visual Studio

I have installed Visual Studio 2022 (64-bit), version 17.7.1

I wanted to use the Intel Fortran compiler as well as the GFortran, that I have gotten used to. I am hoping that some of the tools in Visual Studio, alongside the Intel compiler, might help me resolve some deep logical problems in my code.

I have opened up my model in a VS project and have Intel Fortran installed through oneAPI.
I have also installed C++ libraries.

When I go to debug my model I get an error message: cannot open file ‘kernel32.lib’

I have searched online and found this has occurred lots of times. Statements such as resetting the compiler (done; did not work) and adding folders to my path are everywhere but I am concerned that, aside from the reset option, most others vary from person to person.

Knowing how knowledgeable you all are, I am hoping someone on here is going to instantly recognise the issue and tell me the simple fix; so that I can get on with coding, in what looks like an excellent IDE (I used to love coding in VS way back when).

LINK: fatal error LNK1104: cannot open file ‘kernel32.lib’ - Intel Community seems relevant. I’d like to see the buildlog.htm (in the Debug folder) from a failed build.

Just to check - you get this error when building the application, not when starting the debugger, right?

This post on the Intel Fortran forum indicates that your version of VS 2022 may not (yet) be supported by oneAPI Fortran. Going back to a slightly older version may be advised.

Yes, roll back to VS2022 v17.6.x or older.
I am working on either get a compiler patch release or, preferably, an updated Integrations stand-alone kit to enable v17.7.0. Our next official release is months away, obviously unacceptable. VS does have a way of breaking us with their updates.

o roll back VS:

  1. run VS installer

  2. press the More button

  3. look for ‘Rollback to previous version’ and choose it

1 Like

It looks as if I can only download either 2022 v17.7 or 2019 16.x now. :frowning:

That is correct. Microsoft provides just the latest version for their Community Download. If you need older versions I believe you need a paid support license from them. If you have had VS2022 installed earlier this year, and updated to 17.7, you can use the VS Installer Rollback feature.

I am not aware if this issue affects VS 2019. It has only been reported against 2022 v17.7

Hi garynewport, “kernel32.lib not found.”
Do you have kernel32.lib on your computer? A search of mine finds 77 copies. Then in Visual Studio, right-click on your project, “Properties”, “Configuration Properties”, “Linker”, " “Additional Library Directories”, and add a folder containing kernel32.lib.
Does this work for you?