Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Procedure entry point InitializeConditionVariable could not be located in kernel32.dll

I am running producer consumer problem( using windows thread ).It compiling successfully but on running it showing following error

The procedure entry point InitializeConditionVariable could not located in the dynamic library Kernel32.dll.

can u tell what would be reason

like image 315
Suri Avatar asked May 17 '10 09:05

Suri


1 Answers

That's an API function that is only available in Vista and up. I would guess that you are running this code on XP.

To avoid accidentally using API functions that are only available in later versions of Windows, you'll want to define the _WIN32_WINNT macro:

#define _WIN32_WINNT 0x502   // Designed to run on Windows XP SP2 and up
#include <windows.h>

If you don't set it then it typically defaults to 0x600 on later versions of the Windows SDK, selecting Vista as the target operating system. Btw, you'll probably have to give up on condition variables. There isn't enough detail in your question to offer a suitable replacement. Code that uses mutexes instead shouldn't be hard to find.

like image 54
Hans Passant Avatar answered Sep 27 '22 22:09

Hans Passant