Unable to Include UNiagaraComponent?

I’m experiencing an issue trying to include UNiagaraComponent.h into my .cpp file.

Here’s an image of the IDE (VS 2022) complaining about the inclusion
image

Here’s an image of the UE5 Documentation on this Class.

Any form of help would be appreciated.

1 Like

Does it compile or is it just a squiggly line?
Did you add the Niagara module to your .build.cs file?

1 Like

The compiler threw a Live Coding error, which is irrelevant to the posted issue, but it’s unavoidable.

Here’s the console output.

Regarding whether I have added the Nigara module to my .build.css file. I don’t know anything about this file nor do I know what purpose it serves, I presume that It’s not added.

Then do it. Open %YourProjectName%.build.cs and you’ll see a list of modules. Add “Niagara” there.

Anytime you #include something unfamiliar and get errors, looks up the module in the documentation. If it’s not in your list, add it.

2 Likes

Hey, it worked like a charm, thanks!

Out of curiousity, would you happen to know why the Engine doesn’t add this dependancy by default? Thanks.

Because c++ is about connecting as few things as possible. If may not need Niagara, why add it be default?
There are lots of things not added by default that you might need from time to time, like physics, UMG etc. They will still work in the game, but in order to access them in code, you need to add dependencies manually.

1 Like

This makes perfect sense, I had a similar assumption to this before reading your reply.

So I do have one more question if you don’t mind of course.

Dependancies like Physics, UMG, etc, are they by default not added to the dependancies list due to their expected minor usage opposed to dependancies like Core, Engine, InputCore, etc?

I guess so.