"Cannot open source file" on generated engine files?

I’m trying to set up an AnimInstance using the following include statement:

#include "AnimGraphRuntime/Public/KismetAnimationLibrary.h"

However when I try to compile, Visual Studio throws an error that it can’t find the source file “KismetAnimationLibrary.generated.h.” When I open up KismetAnimationLibrary.h, the generated file does indeed appear to be missing. I know how to regenerate files on my own project, but not on the engine itself. Ideas? Using UE 5.0.2.

This may be a longshot, but I had a similar problem some time ago with other files not being able to be found. Have you tried including the “AnimGraphRuntime” module in your build settings? In your game’s .Build.cs, add

	PublicDependencyModuleNames.Add("AnimGraphRuntime")
2 Likes

In the documentation always look for the include section

Under the area References:
Include #include “KismetAnimationLibrary.h”

This is the part you want to include not the full engine path
And as stated above check the documentation for the part where it says module: AnimGraphRuntime

I found this was a a huge issue with not being able to locate the KismetAnimationLibrary.h header, even used Kismet/KismetAnimationLibrary.h same issue from a few errors to eventually to many errors, it all reverted back to unable to locate KismetAnimationLibrary - my work around = the first file change is in the project.build.cs ”  

under - PublicDependencyModuleNames.AddRange(new string[] { 
			"Core", 
			"CoreUObject", 
			"Engine", 
			"InputCore", 
			"EnhancedInput",
			"AnimGraphRuntime" // This is the correct module for the Animation Library`

Then in the file you are calling it from "xAnimInstance.cpp = 

I added these "#include Kismet/KismetMathLibrary.h // Add this include"
#include KismetAnimationLibrary.h // Add this include"

This worked for my build -  I am a little confused why this was an issue in the first place?