Author Topic: Problem linking to ucrt.lib  (Read 283 times)

markallyn

  • Member
  • **
  • Posts: 236
Problem linking to ucrt.lib
« 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

fearless

  • Member
  • ****
  • Posts: 541
    • Github
Re: Problem linking to ucrt.lib
« Reply #1 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

Code: [Select]
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

Code: [Select]
LIB="C:\Lib";
fearless

Lian Li PC-O11DW Case, ASUS Crosshair VIII Hero, AMD Ryzen 9 5950X, 32GB DDR4, MSI RX 5700XT, NZXT Kraken Z73, Seasonic 1000W PSU

My Github  Twitter  My Gitbook

markallyn

  • Member
  • **
  • Posts: 236
Re: Problem linking to ucrt.lib
« Reply #2 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

fearless

  • Member
  • ****
  • Posts: 541
    • Github
Re: Problem linking to ucrt.lib
« Reply #3 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.
fearless

Lian Li PC-O11DW Case, ASUS Crosshair VIII Hero, AMD Ryzen 9 5950X, 32GB DDR4, MSI RX 5700XT, NZXT Kraken Z73, Seasonic 1000W PSU

My Github  Twitter  My Gitbook