Got a plugin compilation issue that is kicking my *** inside of 4.24.3 in trying to work out how to get around it.
To give some details - I’m creating a plugin that uses some Slate functionality to draw a menu. It does other things - networking streams, etc.
Now, the slate stuff to add the menu is added, and we had to add the UMG and Slate packages to the plugin build .cs file, to ensure those modules are available for use inside the plugin, all straightforward so far.
However, I see this everytime I do a compile going forward.
2> [4/6] Module.AperturePlugin.cpp
2>C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winnt.h(584): warning C4005: ‘TEXT’: macro redefinition
2> c:\program files\epic games\ue_4.24\engine\source\runtime\core\public\HAL/Platform.h(996): note: see previous definition of ‘TEXT’
2>C:\Program Files\Epic Games\UE_4.24\Engine\Source\Runtime\SlateCore\Public\Widgets/Accessibility/SlateCoreAccessibleWidgets.h(35): error C3668: ‘FSlateAccessibleWidget::GetClassNameW’: method with override specifier ‘override’ did not override any base class methods
2>c:\program files\epic games\ue_4.24\engine\source\runtime\slate\public\Widgets/Input/SHyperlink.h(90): error C2259: ‘FSlateAccessibleHyperlink’: cannot instantiate abstract class
2> c:\program files\epic games\ue_4.24\engine\source\runtime\slate\public\Widgets/Input/SHyperlink.h(90): note: due to following members:
2> c:\program files\epic games\ue_4.24\engine\source\runtime\slate\public\Widgets/Input/SHyperlink.h(90): note: ‘FString IAccessibleWidget::GetClassName(void) const’: is abstract
2> C:\Program Files\Epic Games\UE_4.24\Engine\Source\Runtime\ApplicationCore\Public\GenericPlatform/GenericAccessibleInterfaces.h(337): note: see declaration of ‘IAccessibleWidget::GetClassName’
Now, fairly obviously, there is some renaming going on at the root level of the FSlateAccessibleWidget::GetClassName by the compiler, where it’s adding the W at the end to signify that this is a Wcharacter implementation. And obviously the concrete inheritance of that class doesn’t have that function defined (I went and looked - FSlateAccessibleHyperlink, which inherits from the pure virtual FSlateAccessibleWidget class does create a GetClassName override function, but not a GetClassNameW function).
Now, as to WHY the building of the pure virtual version of the interface class is adding a W to the end, I’ve no idea. The project I build is generated from right clicking the UnrealProject plugin file, so it’s not like I’m messing with project settings. nor do I even understand how it’s getting to the code required to rebuild the FSlateAccessibleHyperlink class in the first place, inside the Aperture.cpp class, since the only headers in that file are for:-
#if WITH_EDITOR
#include “Misc/ConfigCacheIni.h”
#endif
#include “Modules/ModuleManager.h”
#include “Modules/ModuleInterface.h”
so, how we are getting to needing to rebuild that class when building that CPP file is beyond me.
My gut feeling is that somewhere, in the include tree (or something in the build system, which appears to be all black box, so I can’t see exactly what is being attached per .cpp file compiled) is resetting the text mode from unicode to W, which is why the compiler is trying to rename the interface class (although why it’s doing that I couldn’t tell you - I had thought it only did this to Windows specific definitions?) - what that might be I’ve no clue.
For the TEXT redefinition, I suspect there is an order of operation issue of header includes. It looks like Hal/Platform.h is being included, since there’s a TEXT definition in there, and then later, winnt.h is included by something, which also has a TEXT definition in it, and since it’s already defined inside of Hal/Platform.h, we see this warning. Why that would be, I don’t know.
Further information - we are adding some winsock header files in a different .cpp file, since the plugin includes shared networking code with an exterior code - this we need access to winsock. However, this is not the file we are seeing this compilation error on. Plus, the TEXT warnings were present before we added the Slate code, and the plugin still compiled just fine and ran with no problems, even with the warning.
I’m stopped cold by this, and really need help - pretty please awesome Epic people?