Linker error FMeshDescription

Sorry, title edit. I was reading a few things that got StaticMeshDescription stuck in my head. I don’t actually use a StaticMeshDescription object anywhere. Just a FMeshDescription object that is instantiated as “FMeshDescription MeshDescription = BuildMeshDescription(AssetNode.ProcMeshComponent);”

TITLE EDIT: StaticMeshDescription to FMeshDescription

Hi,
A fairly simple issue that I’m unable to fix…

I am trying to convert procedural meshes to static meshes in c++. To do this I lifted the code present in ProceduralMeshComponentDetails.cpp and added it to my main code. When I compile, I get linker errors with FMeshDescription-

LNK2019 unresolved external symbol “__declspec(dllimport) public: __cdecl FMeshDescription::~FMeshDescription(void)” (_imp??1FMeshDescription@@QEAA@XZ) referenced in function “public: void __cdecl ARealtimeCADModelActor::DrawPrim(struct FMeshSection)” (?DrawPrim@ARealtimeCADModelActor@@QEAAXUFMeshSection@@@Z)
LNK2019 unresolved external symbol “__declspec(dllimport) public: __cdecl FMeshDescription::FMeshDescription(struct FMeshDescription &&)” (_imp??0FMeshDescription@@QEAA@$$QEAU0@@Z) referenced in function “public: void __cdecl ARealtimeCADModelActor::DrawPrim(struct FMeshSection)” (?DrawPrim@ARealtimeCADModelActor@@QEAAXUFMeshSection@@@Z)
LNK2001 unresolved external symbol “public: __cdecl FMeshDescription::~FMeshDescription(void)” (??1FMeshDescription@@QEAA@XZ)

I looked up a couple of similar posts and it appears that the issue seems to be in the build script where I need to add dependencies. So, I added the MeshDescription module to my publicdependency string in the build script as follows but the issue still persists.

PublicDependencyModuleNames.AddRange(new string[] { “Core”, “CoreUObject”, “Engine”, “AssetRegistry”, “MeshDescription”, “InputCore”, “ProceduralMeshComponent”, });

What should I be doing here?

I see there is a method "ARealtimeCadModelActor::DrawPrim(struct FMeshSection)

FMeshSection is part of AlembicLibrary module, maybe that could solve the issue?

Sadly no:/

FMeshDescription is defined in MeshDescription.h. I have two git-built versions of unreal, 4.22 and 4.25. Intellisense shows two both versions of the header. Is it possible that my project is referencing the wrong version?

I’m talking about FMeshSection, not FMeshDescription.

Ah ok! Sorry! It got me a bit confused.

The FMeshSection that I’m using is a custom defined struct that is not related to the AlembicLibrary module. I’ve not included that module and hence there should be no conflicts there

You should add the “StaticMeshDescription” module to your build.cs file.

Correct module name is “MeshDescription”.
How to figure it out

  1. Open Visual Studio, open the file, referencing undefined symbol
  2. Ctrl-Left Mouse Click on it, and Visual studio shows you list of sources, where it is declared.
    In my case it was C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\MeshDescription\Public\MeshDescription.h
  3. Looking for .build.cs file near that header, I’ve found that it is MeshDescription.build.cs