0

I looked for an answer here and all over the internet, but I can't figure out this. I'm trying to add threading to my 32bit app, but compiler is complaining about:

error LNK2019: unresolved external symbol _InitializeConditionVariable
error LNK2019: unresolved external symbol _SleepConditionVariableCS
error LNK2019: unresolved external symbol _WakeConditionVariable
error LNK2019: unresolved external symbol _WakeAllConditionVariable
error LNK2019: unresolved external symbol _InitializeSRWLock
error LNK2019: unresolved external symbol _AcquireSRWLockShared
error LNK2019: unresolved external symbol _TryAcquireSRWLockShared 
error LNK2019: unresolved external symbol _AcquireSRWLockExclusive
error LNK2019: unresolved external symbol _TryAcquireSRWLockExclusive
error LNK2019: unresolved external symbol _ReleaseSRWLockExclusive
error LNK2019: unresolved external symbol _ReleaseSRWLockShared

No output at dumpbin /exports kernel32.dll | find "InitializeConditionVariable" and cl options are not helping either:

/link /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x86\"

I found above path to contain latest kernel32.lib having missing symbols. How to fix above errors?

Ilir Liburn
  • 222
  • 1
  • 2
  • 6
  • I found it easier to use environment variables rather than the command line arguments, to the question, you are required to specify the exact libraries needed for linking when using CL through the console, for the synchapi.h header, I think you need to link with kernel32.lib – Expolarity Oct 08 '20 at 19:33
  • Thanks. According to MS spec, cl is first looking at /LIBPATH command line, and then environment variable. In other words, I tried to redirect cl to correct version of the kernel32.lib. But that is probably wrong because of the library dependencies. In mean time, I tried to compile using 64bit environment, that worked well, but app is failing while loading 32bit DLLs. Now I'm looking at vcbuildtools.bat, which is configuring environment variables by looking at default SDK in registry, and that seems to be wrong (outdated SDK missing above symbols) – Ilir Liburn Oct 08 '20 at 20:21

0 Answers0