Explanation about build.cs system and module

Hi folks !

Recently I have been trying to develop a plugin editor to better understand how unreal works internally.
I have stumbled on a particular problem which I think may be related to build system (.cs file).

Basically I am attempting to create a special landscape class (that I called APTELanscape) which inherits from ALandscape (I want to add some informations to standard landscape).
Using the editor I created my cpp class which is as follow (I just added one constructor, the remaining part is by-default) :

.h file :




#pragma once

#include "CoreMinimal.h"
#include "Landscape.h"
#include "PTELandscape.generated.h"

/**
*
*/
UCLASS()
class PTE_API APTELandscape : public ALandscape{

GENERATED_BODY()

public :

APTELandscape(const FObjectInitializer&);

};



.cpp file ;




#include "PTELandscape.h"


APTELandscape::APTELandscape(const FObjectInitializer& Args) : ALandscape(Args){

}



When I try to compile this code (and a bunch of other stuffs that works perfectly, I get the following error, all related to virtual methods of ALandscapeProxy (which ALandscape inherits from) :





Erreur LNK2019 symbole externe non rÚsolu "public: virtual __cdecl ALandscapeProxy::~ALandscapeProxy(void)" (??1ALandscapeProxy@@UEAA@XZ) rÚfÚrencÚ dans la fonction "public: virtual __cdecl ALandscape::~ALandscape(void)" (??1ALandscape@@UEAA@XZ) PathToExile E:\Unreal_projects\PathToExile\Intermediate\ProjectFiles\Module.PTE.cpp.obj 1

Erreur LNK2001 symbole externe non rÚsolu "public: virtual __cdecl ALandscapeProxy::~ALandscapeProxy(void)" (??1ALandscapeProxy@@UEAA@XZ) PathToExile E:\Unreal_projects\PathToExile\Intermediate\ProjectFiles\Module.PTE.gen.cpp.obj 1


and many others that are similar ...



Link error often stands for missing DLL so I went to unreal documentation in ALandscapeProxy : ALandscapeProxy | Unreal Engine Documentation
And apparently it requires module “Landscape” to be used. So I added it to my build.cs. I don’t really understand the difference made by unreal between private and public dependencies from Unreal point of view (if somebody can explain I would be happy too !) so I added Landscape to both sections.

Here is a view of my build.cs (I used many modules to test stuffs so many things should be useless in the current state) :



// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class PTE : ModuleRules
{
public PTE(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;

PublicIncludePaths.AddRange(
new string] {
// ... add public include paths required here ...
}
);


PrivateIncludePaths.AddRange(
new string] {
// ... add other private include paths required here ...
}
);


PublicDependencyModuleNames.AddRange(
new string]
{
"Core", "CoreUObject", "Engine", "InputCore", "Foliage", "Slate",
"SlateCore", "InputCore", "UnrealEd", "LevelEditor","LandscapeEditorUtilities",
"LandscapeEditor", "Landscape", "PropertyEditor", "EditorStyle", "EditorWidgets",
"HeadMountedDisplay", "FoliageEdit"
// ... add other public dependencies that you statically link with here ...
}
);


PrivateDependencyModuleNames.AddRange(
new string]
{
"Core",
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"InputCore",
"UnrealEd",
"LevelEditor",
"LandscapeEditorUtilities",
"LandscapeEditor",
"Landscape",
"PropertyEditor",
"EditorStyle",
"EditorWidgets",
"HeadMountedDisplay",
"FoliageEdit"
}
);


DynamicallyLoadedModuleNames.AddRange(
new string]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}




Any idea what may cause this problem to arise ? I had simular problem trying to use functions from LandscapeEditor class even though I had included the module LandscapeEditor so I think I may be missunderstanding something.

Anyway If you could explain me the reason for this error I would be very grateful !

Thanks in advance !

Hello, Oncle_Pixou!

Both ALandscape and ALandscapeProxy are marked as MinimalAPI and it seems you can’t directly extend engine classes marked as MinimalAPI:
https://answers.unrealengine.com/que…l-symbols.html
https://forums.unrealengine.com/deve…ting-c-classes

Maybe this can explain the problem you’re having?