I’ve managed to generate project files under VS2015 but during compilation of the engine there’s the error C4458 “Declaration of foo hides class members”. I’ve never actually got this error before and MSDN does not say anything useful. Is there some way to get around this error perhaps with some specific project setting? Thanks
I get this warning about my character.cpp in vs when building (clean and build ue4.13)
C4458: declaration of 'InputComponent' hides class member
22> G:\Code\GitHub\UE4_Preview\Engine\Source\Runtime\Engine\Classes\GameFramework/Actor.h(316): note: see declaration of 'AActor::InputComponent'
Does disabling the warning fix anything or does it just not display the warning?
The editor, packaged game and dedicated server all work.
I do get this error in the dedicated server log every once and a while…
Hello DamirH I just experienced the bug where I was receiving the input component warning listed above. I am uncertain on how to replicate it but I have an idea on how it happened, and a possible solution.
My circumstances are the following I couldn’t compile my game code changes due to a bug with my precompiled headers, to fix what ever had gone wrong with my precompiled headers I decided to clean and rebuild the solution (Engine and Game).
I cleaned and rebuilt the solution. It rebuilt successfully but I had a bug in my code. I fixed the bug and ran the editor. When ever I attempted to hot reload compile I was getting the InputComponent warning, despite being 100% sure there was no fault with my InputComponent.
I believe that building the solution while there was an error within my code caused this warning to exist.I don’t know why it caused this but it is worth noting that the bug I was fixing was within a function I was binding to an input event within the InputComponent.
What I then did after that was right click my UE4 module and cleaned and built it separately.
Then built my game module separately as well.
Then when I launched my game and hot recompiled, I didn’t see the error any more.
The warning occurs because the method parameter has the same name as a (parent) class member.
You can get rid of it by renaming the method parameter, e.g. to inputComponent (with lowercase i).
But (assuming the method that causes the warning is SetupPlayerInputComponent) it shouldn’t matter, since the input component handed to the method is identical to the class member (see APawn::PawnClientRestart()). Because of that, it’s also irrelevant if you use InputComponent or inputComponent (or whatever name you chose for the method paramter) inside SetupPlayerInputComponent - but it might be better to use the method parameter, just in case something changes in later engine versions …