Can't find "EnhancedInputComponent.h" in CPP

I failed to include “EnhancedInputComponent.h” in cpp code. I haved added “EnhancedInput” module in xxxbuild.cs. Did I miss any other steps?


2 Likes

It could be that Visual Studio is trolling you. I just tested it on my project, and it works quite fine. Does your build fail? Ignore the errors. And switch to Rider, you will forget VisualStudio ever existed.

image

If your build fails, please post error log as text here, so that we can help you.

Also, I found this tutorial, check it out: Unreal Engine: Enhanced Input System in C++ – A_Nightails

3 Likes

I used the compilation button in ue and it turned out to be success. But if I use the “build solution” in vs it failed and output “missing xxx.h error”. So is that Ok?

Probably it’s fine. You are getting an error because you should quit UE, and leave VS open, and then press compile in VS. Then it should work. If not, and if build from UE works, you’re good to go.

Thank you very much. And the link is a very good tutorial :smile:! By the way, do you know how to set my own PlayerController class and Default Pawn class in the cpp code of
my GameMode calss.

You can set it using

PlayerControllerClass = YourPlayerController::StaticClass();
DefaultPawnClass = YourPawn::StaticClass();

You should have these available in contructor of your game mode.

For me was because my VS Code was 32 bits, and the .dll was 64 bits. Just swapped to the 64 bits version and the same issue is gone.

For me, it was to add EnhancedInput to the build.cs, and then delete all cache files and rebuild

I had the same problem, even I add “EnhancedInput” in the xx.Build.cs file, it doesn’t work.

So I right click the folder of the project in Solution Explorer, then choose Properties at the bottom.
Then VS opens the Property Pages, on the left choose “VC++ Directories” then on the right in the “Include Directories” , edit it and add the path where the header files are stored. For mine, it is “C:/Program Files/Epic Games/UE_5.2/Engine/Plugins/EnhancedInput/Source/EnhancedInput/Public/”
Then apply it.
It works now, hope it works for you.

Thanks google gemini!

3 Likes