C++ project compile errors

I am working on my first project and using C++ to do some work. When I try to build the C++ project I get several errors including UMaterialInstanceConstant* cannot be converted to UMaterialInterface, FActorSpawnParameters is not defined, GEngine is not defined, World is an incomplete class type and cannot be used. If I comment out the line associated with the first issue, and do a full rebuild the build will succeed. But just building causes these errors. I assume that there is something missing from my project but I cannot figure out what?

Any ideas on the causes of these issues?

Thank you

That is what I thought with the includes but why would it work with a full rebuild and not a regular build?

As for the code to include not sure what or how much to add here.

I have 2 classes one for the game board and one for pieces. The Grid class has the following includes:
#include “GamePiece.h”
#include “CoreMinimal.h”
#include “GameFramework/Actor.h”
#include “TicTacToeGrid.generated.h”

My Game Piece class has:

#include “CoreMinimal.h”
#include “PaperSpriteActor.h”
#include “GameFramework/Actor.h”
#include “GamePiece.generated.h”

I tried to change CoreMinimal to Core and that did not work. I also tried to include World but that gave more errors.

I suppose your classes are not inheriting UObject ?
To narrow down some errors - try to #include "Engine.h"

That actually resolved all of these problems. Now I get a message ‘identifier “FDrawingPolicyRenderState” is undefined’ about 80% of the time when I build. If I rebuild the solution than everything works well.

Hi, it is very hard to help you without seeing the actual code.
Some of the errors probably means that you are missing some include files.

Your solution helped me thanks