The MASM Forum

General => The Campus => Topic started by: markallyn on October 24, 2021, 02:57:29 AM

Title: Problem linking to ucrt.lib
Post by: markallyn on October 24, 2021, 02:57:29 AM
Hello everyone,

I have encountered a problem linking against ucrt.lib.  On my windows 10 machine the file is located in Windows Kits.  If I set my system LIB path variable to the search path for ucrt.lib and try to link to the program the sys reports it can't find ucrt.lib  HOWEVER, if I use following includelib in the source code all proceeds as desired:

Quote
includelib c:\Program Files (x86)\windows kits\10\lib\10.0.10150.0\ucrt\x64\ucrt.lib

I have checked the LIB variable (using echo %LIB%) and the path is plainly there.  Could someone kindly explain what's going on.

Thanks,
Mark Ally
Title: Re: Problem linking to ucrt.lib
Post by: fearless on October 24, 2021, 04:11:24 AM
Might be the white space. Could try to wrap the LIB var with an extra pair of " quotes surrounding the path, so set

LIB=""c:\Program Files (x86)\windows kits\10\lib\10.0.10150.0\ucrt\x64\"";

Failing that a path with very little like C:\lib and set

LIB="C:\Lib";
Title: Re: Problem linking to ucrt.lib
Post by: markallyn on October 24, 2021, 08:47:51 AM
Good evening, Fearless,

Yes, your suggestion worked beautifully.  Unfortunately it is proving hard to implement.  First off, setx function is unknown to Win 10 so I can't permanently alter the LIB search path from the console.  So, I tried to do this by editing the system environment variables.  Problem:  The advanced settings window won't allow double quotes (""...""). 

What does work is to modify my .bat build file so that the leading statement is "set LIB= ....".  This is ugly, but it works.

If there is another approach, I'd love to hear about it.

Thanks again,
Mark
Title: Re: Problem linking to ucrt.lib
Post by: fearless on October 24, 2021, 08:53:46 AM
Might be worth looking at: https://www.rapidee.com/en/about

Useful for editing those environment variables, might allow double quoting as its probably just saving to a registry key somewhere - which would be another option, modify the registry directly and place the double quoted path there.