Can't create UWidgetComponent for non player actor in C++.

Do you have the proper dependencies set up in your project’s build.cs file? Depending on what you plan to do with your widget, your project may need to depend on UMG, Slate, and/or SlateCore.