Hello,
When I include and use MeshBasicEditFunctions.h in my header file, it will not compile and instead give the error C4430 on lines 22, 78, 91 and 93. When searching in the source it gives : GENERATED_BODY()
, GENERATED_BODY()
, class GEOMETRYSCRIPTINGCORE_API UGeometryScriptLibrary_MeshBasicEditFunctions : public UBlueprintFunctionLibrary
and GENERATED_BODY()
. I don’t what to do, it worked before but at sometime it stop working…
Hi @pastalapate,
Bit hard to tell without seeing your code but could you check the following:
- Do you have the
#include "YourHeaderFile.generated.h"
in your header file? - Do you have
GENERATED_BODY()
in your class? - You could also try Regenerate Project Files or do a Clean and Rebuild
Here is my header and I have already tried to delete Intermediate, Binaries, and Saved to fully regenerate the project
#include "CoreMinimal.h"
#include "DynamicMesh/DynamicMesh3.h"
#include "Components/DynamicMeshComponent.h"
#include "GeometryScript/MeshBooleanFunctions.h"
#include "GeometryScript/MeshPrimitiveFunctions.h"
#include "GeometryScript/MeshSpatialFunctions.h"
#include "GeometryScript/MeshAssetFunctions.h"
#include "GeometryScript/MeshNormalsFunctions.h"
#include "GeometryScript/MeshTransformFunctions.h"
#include "DynamicMeshActor.h"
#include "WE_DMGrass.generated.h"
/**
*
*/
UCLASS()
class WORDENGINE_API AWE_DMGrass : public ADynamicMeshActor
{
GENERATED_BODY()
public:
UFUNCTION(CallInEditor, BlueprintCallable)
void GenerateGrassMesh();
UFUNCTION(CallInEditor, BlueprintCallable)
void ClearGrass();
UFUNCTION(CallInEditor, BlueprintCallable)
void GenerateAsyncGrassMesh();
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Grass")
UMaterialInterface* GrassMaterial;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Grass")
float GrassDensity = 250.f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Grass")
float TileSize = 5000.f;
TArray<FVector> Vertices;
TArray<FVector2D> UVs;
TArray<FIntVector> Triangles;
};
class FAsyncDMGrassGenerator : public FNonAbandonableTask
{
public:
FAsyncDMGrassGenerator(AWE_DMGrass* InGrass) : Grass(InGrass)
{
};
FORCEINLINE TStatId GetStatId() const
{
RETURN_QUICK_DECLARE_CYCLE_STAT(FAsyncDMGrassGenerator, STATGROUP_ThreadPoolAsyncTasks)
}
void DoWork();
private:
AWE_DMGrass* Grass;
};
And my start of the cpp file:
#include "WE_DMGrass.h"
#include "GeometryScript/GeometryScriptTypes.h"
#include "GeometryScript/MeshBasicEditFunctions.h"
Thanks for sharing the code. Sorry for the delay in getting back to you.
You are also missing #pragma once
at the top of your file.
Have you tried adding the required dependencies in Your Project’s .Build.cs
File?
Not 100% sure but I would guess you need
DynamicMesh, "GeometryCore", "GeometryScriptingCore", "GeometryFramework"
Yeah it has #pragma once
I’ve just not copied it. And my Build.cs looks like this:
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core", "ProceduralMeshComponent", "Foliage", "PhysicsCore",
"DynamicMesh",
"GeometryCore",
"DynamicMesh",
"GeometryCore",
"GeometryScriptingCore",
"GeometryFramework",
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"MeshDescription", "StaticMeshDescription", "AssetRegistry","DynamicMesh"
}
);
Hi @pastalapate,
I took all the code you provided and put it into a new project with Engine version 5.5.4. Everything complied fine.
I did notice you have DynamicMesh
and GeometryCore
twice in your PublicDependencyModuleNames
.
In your cpp
file, could you provide me with one of the functions/structs you are using from MeshBasicEditFunctions
?
Could you double check your cpp
file that you have all the closing braces? I’ve had it in the past where it all looks fine but causes issues in other files as it has a knock on effect.
Only other thing I could thinking of is running Generate Project Files or move some code into a clean project and see if you have similar issues, alternatively you could comment out parts of the code and see which parts cause the errors to start showing.
Hi @SylarAtomic,
Here it is .
void AWE_DMGrass::GenerateGrassMesh()
{
UDynamicMesh* DynamicMesh = DynamicMeshComponent->GetDynamicMesh();
DynamicMeshComponent->ConfigureMaterialSet({ GrassMaterial });
float Gap = TileSize / GrassDensity;
for (int32 X = 0; X < GrassDensity; X++)
{
for (int32 Y = 0; Y < GrassDensity; Y++) {
FVector Position = FVector(X * Gap, Y * Gap, 0) + GetActorLocation();
FHitResult HitResult;
FCollisionQueryParams CollisionParams;
bool bHit = GetWorld()->LineTraceSingleByChannel(HitResult, Position + FVector(0, 0, 10000), Position + FVector(0, 0, -10000), ECC_Visibility, CollisionParams);
if (!bHit)
{
continue;
}
FVector HitLocation = HitResult.Location - GetActorLocation();
Vertices.Add(HitLocation);
Vertices.Add(HitLocation + FVector(0, 0, 50));
Vertices.Add(HitLocation + FVector(0, 5, 0));
int32 FirstIndex = Vertices.Num() - 3;
Triangles.Add(FIntVector(FirstIndex, FirstIndex + 1, FirstIndex + 2));
UVs.Add(FVector2D(0, 0));
UVs.Add(FVector2D(0.5, 1));
UVs.Add(FVector2D(1, 0));
}
}
FGeometryScriptSimpleMeshBuffers MeshBuffers = FGeometryScriptSimpleMeshBuffers();
MeshBuffers.UV0 = UVs;
MeshBuffers.Triangles = Triangles;
MeshBuffers.Vertices = Vertices;
FGeometryScriptIndexList IndexList;
UGeometryScriptLibrary_MeshBasicEditFunctions::AppendBuffersToMesh(DynamicMesh, MeshBuffers, IndexList);
}
I don’t know why it doesn’t work now, it was working fine until at a moment, it failed compiling with the same code that was compiling before I tried generated project files etc 3x and it doesn’t work
Hi @pastalapate
That code works perfectly on my machine
The issue looks to be related to UHT but often the cause is obscure.
I’m guessing you have done all these steps?
- Close Visual Studio and Unreal Editor
- Delete these folders: (You mentioned this earlier)
- Intermediate
- Binaries
- Saved
- Also try removing the .vs/ folder (if it exists)
- Right-click on your .uproject file and “Generate Visual Studio project files”
- Open the solution in Visual Studio
- Rebuild the solution using Clean Solution followed by Build Solution
- Restart your computer (sometimes this helps with stubborn build issues)
- Open the project again
Only other things I could think of:
- Using source control, stash your changes and see if the are any issues.
- Verify your UE install
- Make a new test project and try include
MeshBasicEditFunctions.h
- Compare your
MeshBasicEditFunctions.h
with the version on Epic Games GitHub for UE
Let me know if you do figure it out!