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

cannot open file libucrt.lib

Pedro_Sant_Anna
Beginner
2,736 Views

Hi,

I used to have on my old computer the Intel Visual Fortran Composer XE 2011, integrated with Microsft Visual Studio 2010, and with IMSL 6.

Now I have upgraded to the Intel Parallel Studio XE Composer Edition for Fortran Windows* with Rogue Wave* IMSL* 7.0.

What is happening is that now, some of my Fortran programs are not compilling. It gives me the following error:

fatal error LNK1104: cannot open file libucrt.lib

Do you know why this happens? can you help?

Thanks

0 Kudos
11 Replies
Pedro_Sant_Anna
Beginner
2,736 Views

In fact, not even the simplest Hello World example is working, due to the error: 

fatal error LNK1104: cannot open file 'ucrt.lib'

I am with Windows 10.

0 Kudos
Pedro_Sant_Anna
Beginner
2,736 Views

Problem solved!

The issue was that  Visual Studio 2015 has changed the version number of the ucrt.

I had to manually change it on LIB, and also include it on INCLUDES.

Now, it is working. My question is that I have two versions: 10.0.10240.0 and 10.0.10150.0

What is the difference between them? Which one should I use? Both seems to work.

0 Kudos
Paul_Anton_L_
Beginner
2,736 Views

I've got the same issue, but I didn't understand what the fix was or what the underlying problem is.

I'm using CMake to generate Visual STudio projects. Looks like I should downgrade to Visual STudio 2013 - or is there a proper workaround for this?

0 Kudos
Steven_L_Intel1
Employee
2,736 Views

The underlying problem is that Visual Studio 2015 adds a new library in a new location that is required to be linked in when the MSVC libraries are used. It is necessary that the correct path be included in the LIB environment variable (for command line building) or in the "Library Files" list in Visual Studio. Microsoft's method of locating this folder is complicated and changed over the course of the VS2015 beta.

The library is found under C:\Program Files (x86)\Windows Kits\10\Lib - in here there will be one or more folders with names such as 10.0.10150.0 and then under that a ucrt and then a set of folders for different architectures. If you use the Intel-supplied .bat files, such as ifortvars.bat, to establish the command line environment, you should get the right one. In Visual Studio it may take resetting the set of Library Files folders to get it right.

0 Kudos
TimP
Honored Contributor III
2,736 Views

In my installation, ifortvars.bat sets up LIB and INCLUDE to point to the smallest numbered folder (10.0.10056.0) under Windows Kits\10\, although that is incomplete (but does contain ucrt).  Do we need to remove the folder which it chooses in hopes of getting the right one? 

It adds  Windows Kits\8.1\\lib\winv6.3\um\x64 as there is no um in the \10\ folder it has chosen, and also adds Windows Kits\8.1\include\shared (which doesn't take care of missing components in 10.0.10056.0.  There is no path entry for 10.0.10.069.0 which appears to be a complete version.  I have repeated the repair of VS2015, which takes over 4 hours and doesn't resolve the problem.

I didn't use the VS2015 integration much until I found out about the special /arch:AVX2 support in that compiler.  /arch:AVX in VS2015 is nothing special.

0 Kudos
Steven_L_Intel1
Employee
2,736 Views

It's Visual Studio's vcvars32.bat that is doing this. Specifically this line in vcvarsqueryregistry.bat:

@FOR /F "delims=" %%i IN ('dir "%UniversalCRTSdkDir%include\" /b /ad-h /on') DO @SET UCRTVersion=%%i

If I am parsing this correctly, it should end up with the highest version, sorted alphabetically. It could be that they changed things around during the beta so that incomplete or badly-named directories still exist. 10150 should have what you need. If it doesn't, I'd suggest an uninstall and reinstall of VS2015.

0 Kudos
Krave_Z_
Beginner
2,736 Views

Pedro Sant'Anna wrote:

Problem solved!

The issue was that  Visual Studio 2015 has changed the version number of the ucrt.

I had to manually change it on LIB, and also include it on INCLUDES.

Now, it is working. My question is that I have two versions: 10.0.10240.0 and 10.0.10150.0

What is the difference between them? Which one should I use? Both seems to work.

Hi, Pedro,

I have noticed your post about the LNK Error about file libucrt.lib

And I have exactly the same problem as yours.

And you solved the problem by

I had to manually change it on LIB, and also include it on INCLUDES.

Could you please let me know the details about how did you solve the problem?

I use cmd.exe in Windows 7 x64 to build my application.

Hopefully you could see my message and get touch with me.

Thanks.

0 Kudos
TimP
Honored Contributor III
2,736 Views

If you permit VS2015 to upgrade to the VS2015.1 install menu, there are selections for both C++ compiler and SDK 10240, and vcvars should set up accordingly.  The latter SDK appears to be complete regardless of which Windows version you have. SDK 10150 was incomplete but should work if the missing references there are satisfied in another SDK, as long as an older SDK doesn't come earlier in INCLUDE and LIB paths.

0 Kudos
Steven_L_Intel1
Employee
2,736 Views

Krave Z, the paths to the libraries should be set up automatically if you either use the shortcuts we provide to start a command prompt session or you call ifortvars.bat from your session. It is the VS2015 command-line setup script (called from ifortvars.bat) that adds the path to libucrt.lib.

0 Kudos
William_D_2
Beginner
2,736 Views

Steve Lionel (Intel) wrote:

Krave Z, the paths to the libraries should be set up automatically if you either use the shortcuts we provide to start a command prompt session or you call ifortvars.bat from your session. It is the VS2015 command-line setup script (called from ifortvars.bat) that adds the path to libucrt.lib.

 

Ok so I was having similar troubles recently. The problem is the following: under the Tools->Options->Intel Compilers and Tools->Visual Fortran->Compilers->libraries tag there is a poorly defined VS macro. The macro is "UCRTVersion" and it points to wdf. Following the filepath down to the folder specified ($(UniversalCRTSdkDir)Lib\$(UCRTVersion)\ucrt\x86) I noticed that the wdf directory in the Windows Kit Tree did not include UCRT. I instead chaned the Call to the macro to a specific version of the Windows 10 Kit ($(UniversalCRTSdkDir)Lib\10.0.10586.0\ucrt\x86) and everything worked perfectly.

This might be something that needs to be corrected at the VS/Windows Kit Level.

0 Kudos
Christian
Novice
2,736 Views

Hello,

the problem still exists in Intel(R) Visual Fortran Compiler 17.0.0.109 with Visual Studio 2015 Upadte 3. I think the problem lies in this DLL:

c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Intel\Fortran IDE\TOSettings.dll

It looks in the directory

c:\Program Files (x86)\Windows Kits\10\Include\

and takes the last one (lexically) to fill the macro variable UCRTVersion.

If you have installed the Windows Drivers Kit WDK there is a subdirectory named "wdf" which is the last one. So UCRTVersion turns into "wdf". Microsoft had the same problem in their batch files and repaired it by checking if the subdirectory begins with "10."...

Best regards,

Christian

0 Kudos
Reply