I have this constructor:
// Fill out your copyright notice in the Description page of Project Settings.
#include "CTerrain.h"
#include "Components/StaticMeshComponent.h"
#include "Engine/StaticMesh.h"
#include "StaticMeshDescription.h"
// Sets default values
ACTerrain::ACTerrain()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
staticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>("Static Mesh Component");
UStaticMesh* mesh = staticMeshComponent->GetStaticMesh();
meshDescription = mesh->CreateStaticMeshDescription(this);
meshDescription->CreateVertex();
}
With this header file:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "CTerrain.generated.h"
UCLASS()
class MYPROJECT3_API ACTerrain : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ACTerrain();
void GenerateFlatLand(uint32 sizeX, uint32 sizeY);
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
void ModifyTile(uint32 x, uint32 y, TArray<uint32> heights);
uint32 GetIndexFromCoords(uint32 x, uint32 y);
FVector2D GetCoordsFromIndex(uint32 index);
class UStaticMeshComponent* staticMeshComponent;
class UStaticMeshDescription* meshDescription;
uint32 mapWidth;
uint32 mapHeight;
uint32 gridSize;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};
I get a linking error on meshDescription->CreateVertex();
.
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: struct FVertexID __cdecl UMeshDescriptionBase::CreateVertex(void)" (__imp_?CreateVertex@UMeshDescriptionBase@@QEAA?AUFVertexID@@XZ) referenced in function "public: __cdecl ACTerrain::ACTerrain(void)" (??0ACTerrain@@QEAA@XZ) MyProject3 C:\Users\lucas\OneDrive\Documents\Unreal Projects\MyProject3\Intermediate\ProjectFiles\CTerrain.cpp.obj 1
Do you have any indication on how to fix this error?