-
-
Save martindevans/709ce7359ab8571da0af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .h file | |
#pragma once | |
#include "Ship_Component_Interface.generated.h" | |
/** | |
* | |
*/ | |
UINTERFACE(MinimalAPI) | |
class UShip_Component_Interface : public UInterface | |
{ | |
GENERATED_UINTERFACE_BODY() | |
}; | |
class IShip_Component_Interface | |
{ | |
GENERATED_IINTERFACE_BODY() | |
public: | |
virtual void Foo() = 0; | |
}; | |
// .cpp file | |
#include "Space.h" | |
#include "Ship_Component_Interface.h" | |
UShip_Component_Interface::UShip_Component_Interface(const class FPostConstructInitializeProperties& PCIP) | |
: Super(PCIP) | |
{ | |
} | |
/**void IShip_Component_Interface::Foo() | |
{ | |
}*/ | |
#### ship comp ### | |
.h | |
#pragma once | |
#include "GameFramework/Actor.h" | |
#include "Ship_Component_Interface.h" | |
#include "ShipComponent.generated.h" | |
/** | |
* | |
*/ | |
UCLASS() | |
class AShipComponent : public AActor, public IShip_Component_Interface | |
{ | |
GENERATED_UCLASS_BODY() | |
UPROPERTY(VisibleDefaultsOnly, Category = Mesh) | |
TSubobjectPtr<class UStaticMeshComponent> Mesh; | |
UPROPERTY(VisibleDefaultsOnly, Category = Utility) | |
TSubobjectPtr<class USceneComponent> DefaultRoot; | |
public: | |
virtual void Foo() OVERRIDE; | |
}; | |
.cpp | |
#include "Space.h" | |
#include "ShipComponent.h" | |
AShipComponent::AShipComponent(const class FPostConstructInitializeProperties& PCIP) | |
: Super(PCIP) | |
{ | |
DefaultRoot = PCIP.CreateDefaultSubobject<USceneComponent>(this, TEXT("Default")); | |
Mesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Mesh")); | |
Mesh->RelativeLocation = FVector(0.f, 0.f, 0.f); | |
} | |
void AShipComponent::Foo() | |
{ | |
} | |
## ?? | |
Error 6 error LNK2001: unresolved external symbol "public: virtual void __cdecl AShipComponent::Foo(void)" (?Foo@AShipComponent@@UEAAXXZ) C:\Users\Calum\Documents\Unreal Projects\Space\Intermediate\ProjectFiles\ShipComponent.cpp.obj | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment