CreateEvent for threading in Windows


#1

I don’t do much windows dev, and I am trying to work with the Kinect 1.5 SDK so I have to do it on windows. Everything is fine except for one windows function CreateEvent. When I include ofMain.h in the header file I get this error:

  
"error C3861: 'CreateEvent' : identifier not found".   

But when I do not include ofMain, this error no longer appears. Is there a conflict with Poco or something? I am lost on how to resolve this issue. Any suggestions?


#2

I had same problem and seems to solve this now.
Just changed CreateEvent to CreateEventW.
I am not usual windows user and don’t know how different these function though :wink:
Hope this help someone.


#3

You are right. Your issue is related to Poco.
It contains an UnWindows.h that undefines most of the windows Macros.
CreateEvent is such a macro that either is replaced by CreateEventA (unicode) or CerateEventW (ascii).

The correct way to fix your problem is to define POCO_NO_UNWINDOWS somewhere in your code.

Either directly in your code:
#define POCO_NO_UNWINDOWS

or as a compiler flag:
/D POCO_NO_UNWINDOWS

or in CMake:
add_definitions("/D POCO_NO_UNWINDOWS")

I hope this helps somebody.