arnaud-jamin / Cog

Cog is a set of debug tools for Unreal Engine built on top of Dear ImGui
MIT License
357 stars 44 forks source link

CreateWindow function is sometimes conflicting with Win SDK macro #10

Closed Skylonxe closed 1 year ago

Skylonxe commented 1 year ago

Some developers are getting this compilation error:

CogWindowManager.h(42): error C4003: not enough arguments for function-like macro invocation 'CreateWindowW'
CogWindowManager.h(42): error C2988: unrecognizable template declaration/definition
CogWindowManager.h(42): error C2059: syntax error: 'constant'
error C2039: 'CreateWindowW': is not a member of 'UCogWindowManager'

I believe this is caused by WinUser.h

#ifdef UNICODE
#define CreateWindow  CreateWindowW
#else
#define CreateWindow  CreateWindowA
#endif // !UNICODE

It would be probably safest to rename the function to something else.

Some references:

https://www.ultraengine.com/community/topic/2693-createwindow-class-function-conflicts-with-createwindowa/ https://www.codeproject.com/Questions/543783/Functionplusandplusnamespaceplusconflict

arnaud-jamin commented 1 year ago

Thanks, I'll rename that function.

arnaud-jamin commented 1 year ago

fixed in https://github.com/arnaud-jamin/Cog/commit/7f88f5d53a9c8bc631a2c4868e87de3a65972dcd