Download

Unable to extend from UCapsuleComponent

I am trying to extend from the UCapsuleComponent but I run into some issues that I can not explain.


#pragma once

#include "Components/CapsuleComponent.h"
#include "SurfCapsuleComponent.generated.h"

/**
 * 
 */
UCLASS(ClassGroup=Shapes, editinlinenew, hidecategories=(Object,LOD,Lighting,TextureStreaming), meta=(BlueprintSpawnableComponent))
class USurfCapsuleComponent : public UCapsuleComponent
{
	GENERATED_UCLASS_BODY()
};

When I compile this I’ll get the following error


1>SurfCapsuleComponent.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UShapeComponent::GetUsedMaterials(class TArray<class UMaterialInterface *,class FDefaultAllocator> &)const " (?GetUsedMaterials@UShapeComponent@@UEBAXAEAV?$TArray@PEAVUMaterialInterface@@VFDefaultAllocator@@@@@Z)
1>SurfCapsuleComponent.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class UBodySetup * __cdecl UShapeComponent::GetBodySetup(void)" (?GetBodySetup@UShapeComponent@@UEAAPEAVUBodySetup@@XZ)
1>E:\UnrealProjects\SurfGame\Binaries\Win64\UE4Editor-SurfGame.dll : fatal error LNK1120: 2 unresolved externals

Do you have any idea why I get this error? Why doesn’t it find


void UShapeComponent::GetUsedMaterials

and


virtual class UBodySetup * UShapeComponent::GetBodySetup

?

Okay it seems I have to implement them by myself.


void USurfCapsuleComponent::GetUsedMaterials(TArray<UMaterialInterface*>& OutMaterials) const
{

}

class UBodySetup* USurfCapsuleComponent::GetBodySetup()
{
  return this->ShapeBodySetup;
}

Which I don’t understand because UCapsuleComponent didn’t implement those either.


UCLASS(abstract, hidecategories=(Object,LOD,Lighting,TextureStreaming,Activation,"Components|Activation"), editinlinenew, MinimalAPI, meta=(BlueprintSpawnableComponent), showcategories=(Mobility))
class UShapeComponent : public UPrimitiveComponent

I think the problem here is that it is flagged as MinimalAP, do you think that is a bug?

Edit:

I removed minimal api and added ENGINE_API but I’ll get the following errors.


1>d:\program files\unreal engine\4.2\engine\intermediate\build\win64\inc\engine\../../../../../Source/Runtime/Engine/Classes/Components/ShapeComponent.h(11): error C2487: 'GetPrivateStaticClass' : member of dll interface class may not be declared with dll interface
1>d:\program files\unreal engine\4.2\engine\intermediate\build\win64\inc\engine\../../../../../Source/Runtime/Engine/Classes/Components/ShapeComponent.h(11): error C2487: 'UShapeComponent::{ctor}' : member of dll interface class may not be declared with dll interface

I don’t have git access anymore, can someone tell me if this file looks different in >4.2?