Could I get some help resolving a StrategyGame HUD Error?

I create a widget class in StrategyGame. In the .cpp file, I #include “SStrategyMenuItem.h” like SStrategyMenuWidget.cpp did. but there is and error .
错误 1 error C1083: 无法打开包括文件: “SStrategyMenuItem.h”: No such file or directory E:\Unreal\Projects\Strategy Game 4.1\Source\StrategyGame\TopDownSlateHUDWidget.cpp 7 1 StrategyGame

Hi ,

Could you provide more information about how you set up your widget class? What did you choose as the parent class in the Editor, and what is your code for the class?

When I create the class,there is no SCompoundWidget in the Editor,So I just choose Actor as the parent.And I modify the parent class to SCompoundWidget like in the first picture. The second picture is the cpp flie.

Hi ,

I think I see what is happening. The class files for your new Slate widget are not being created in the same location as the rest of the existing Slate files. Try using this line instead:

#include "../Menu/SStrategyMenuItem.h"

Thanks, . It does works.
And,can you tell me how do I know the location of the class?
Why is …/Menu,but not …/UI/Menu?

Hi ,

Your new class file is already located in the /UI/ folder. Using ../Menu/ tells the compiler to look for the header file in the Menu folder inside the current folder.