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

Error LNK1104: Cannot open file 'ifconsol.lib'

MonishYadav
Novice
1,295 Views

I'm trying to compile a user subroutine for a commercial software Ansys. I run a .bat script which compiles the user subroutine written in Fortran and creates an Ansys executable. But I'm getting error stating-

LINK : fatal error LNK1104: cannot open file 'ifconsol.lib'

 

      ************************************************************************

 

          LINK ERROR

 

      ************************************************************************

I run the .bat script from VS 2019 command prompt, and I have 2024 and 2025 intel OneAPI fortran compilers installed and linked.

ifconsol.lib is in "C:\Program Files (x86)\Intel\oneAPI\compiler\2024.2\lib" & "C:\Program Files (x86)\Intel\oneAPI\compiler\2025.0\lib"

In the tabs in VS 2029 Tools>Options>Intel Compilers and Libraries>IFORT Intel Fortran Classic>Compilers I can find the paths for executable, includes, libraries I assume that the above mentioned path is added to them already but I'm not sure, and also there is Win32 and x64 option, the workstation is x64 but the VS 2019 32-bit I guess, I assume x64 is the right one which corresponds to this workstation.

I want to know how to solve this issue, should I add it to the path if it's not added already, but if it's already added how should I tackle this issue.

I'm attaching the pictures of library and include paths which are added already.

Thank you in advance for your assistance!

Screenshot 2024-10-29 124007.png

Screenshot 2024-10-29 131050.png

Screenshot 2024-10-29 124336.png

0 Kudos
1 Solution
andrew_4619
Honored Contributor III
1,257 Views
In the start menu there is a oneapi command prompt shortcut. Run that and then run your bat file in that command prompt.

View solution in original post

5 Replies
Steve_Lionel
Honored Contributor III
1,279 Views

When you say "the VS2019 command prompt", do you mean the one under the Visual Studio start menu folder, or the one under Intel oneAPI? You should use the latter, as the former does not reference the Intel libraries. The settings you see inside Visual Studio are not used from the command prompt.

0 Kudos
MonishYadav
Novice
1,277 Views

Hello Steve!

I open the command prompt from Visual Studio Professional 2019 from the tab Tools>Command Line>Developer Command Prompt, and try to compile it using this. It's according to the instructions given by Ansys in their documentation, by running a .bat provided by them it compiles and also creates an executable.

But I do not understand what you meant by "use the latter, as the former does not reference the Intel libraries". And where you referring to settings when you mentioned "under Intel oneAPI"? I'm completely new to this, so please excuse me if I'm not understanding it properly or if I'm not making any proper sense.

0 Kudos
andrew_4619
Honored Contributor III
1,258 Views
In the start menu there is a oneapi command prompt shortcut. Run that and then run your bat file in that command prompt.
Steve_Lionel
Honored Contributor III
1,257 Views

Thanks for the details. The Ansys instructions are wrong for Fortran - they would be OK for C/C++.

Do this instead. Click on the Start menu and type "oneAPI" (without the quotes). When you see "Intel oneAPI command prompt for Intel 64 for Visual Studio 2019" (or 2022 if you have that), click that. Set your default directory (cd) to the directory with your source (or another writable directory). Now run the Ansys .bat file.

The Visual Studio command prompt does not honor the Intel Fortran directory settings.

MonishYadav
Novice
1,222 Views

Thanks lot of for your help Steve and Andrew!!!

Now I understand, I did it the way you people directed me and it worked!

0 Kudos
Reply