CONDITION_VARIABLE in windows; wont compile

孤人 提交于 2019-11-30 20:43:16

Did you define _WIN32_WINNT and WINVER before #include <windows.h>?

This is necessary to include definitions for things only added in later versions of Windows. For condition variables you need to set these to at least 0x0600 as condition variables were new in V6 (ie. Vista/2008).

See http://msdn.microsoft.com/en-us/library/aa383745%28VS.85%29.aspx

Check that you have latest Windows headers, and WinBase.h has the following line:

typedef RTL_CONDITION_VARIABLE CONDITION_VARIABLE, *PCONDITION_VARIABLE;

And of course, you have _WIN32_WINNT #defined to at least 0x600.

You mentioned that you're using pthread library for threading. Have you looked into this article about using mutex for windows, when using pthread.

Consider using pthreads-win32, which implements the POSIX threads API on Windows, this includes condition variables.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!