I am trying to integrate dlib 19.17 with Unreal 4.22. On including the dlib header i.e. "#include “dlib/image_processing/frontal_face_detector.h” I face the problem below:
I have a UTexture2D* variable called texture. UTexture2D has a function called UpdateResource(). WinBase.h has a macro called “UpdateResource” that calls “UpdateResourceW”. When I call “texture->UpdateResource();”, I get the error “class “UTexture2D” has no member “UpdateResourceW”” (despite not even including winbase.h). Going to the definition in VS takes me to that #define in WinBase.h. So that define in winbase is overwriting the function call, renaming it to UpdateResourceW I guess because of the dlib’s dependency on Winbase.
I faced the same problem.
So I changed engine sources, UTexture, UCanvasRenderTarget2D and so on which all have the function UpdateResource(). I renamed it to UpdateResouce_U().
Then compile was passed, but could not package the project, though I don’t know if it is because of changing the engine source.
Code of winbase shouldn’t be changed. Dlib’s dependency on winbase shouldn’t too. Well I’m in over my head. Too difficult problem it is.
Ah, you can use #undef macro.
Add a code “#undef UpdateResource” before the line which defines “virtual void UpdateResource() override;” in the header file TextureCube.h and CanvasRenderTarget2D.h.
Then, when I built and packaged my project, the errors of UpdateResource macro are removed.
However, there are some errors related to opencv and dlib themselves are remaining, but these are not in this topic.