Download

Thirdparty lib plugin conflicts with UE's check macro

A thirdparty that I use in my plugin defines C++ function “check” under its’ own namespace. However, the project fails to compile because of UE’s “check” macro defined in AssertionMacros.h.
Regardless of the DO_CHECK value, it always evaluates to something, so that build fails.
I believe, such macro shouldn’t have generic names like “check” but rather be prefixed. like ue4_check or something. However, it is what it is.

How this issue can be resolved?

I temporarily fixed it like this: in your plugin’s .cpp file:



#include "MyPlugin.h"
#include "Core.h"
#include "Modules/ModuleManager.h"
#include "Interfaces/IPluginManager.h"

// any other Unreal includes go here...

// lastly, include our library but undef naughty macro...
#ifdef check

#undef check
#include <mylib/mylib.h>

#endif

// ... plugin code


What library are you using? I had the same problem some time ago with opencv, I disabled the check macro in opencv

roscpp library. see my previous answer for the workaround