Download

Cannot use class defined in another module.

If I move this line


IBasicPawnInterface* interf = Cast<IBasicPawnInterface>(pActor);

to a class defined in another module I get error:


 LNK2019 Severity    Code    Description    Project    File    Line    Suppression State
Error    LNK2019    unresolved external symbol "private: static class UClass * __cdecl UBasicPawnInterface::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@UBasicPawnInterface@@CAPEAVUClass@@XZ) referenced in function "public: void __cdecl AMyPlayerController::PossessActor(class AActor *,bool)" (?PossessActor@AMyPlayerController@@QEAAXPEAVAActor@@_N@Z)    MID    C:\Users\Me\Documents\Unreal Projects\MID\Intermediate\ProjectFiles\MyPlayerController.cpp.obj    1    

I added the dependencies in all the places It’s asked to do so.

This is how I define the class in question (an interface)


// This class does not need to be modified.
UINTERFACE(Blueprintable)
class UBasicPawnInterface : public UInterface
{
    GENERATED_BODY()
};

/**
 * @author Giulio_M
 *
 */
class BASICFRAMEWORK_API IBasicPawnInterface
{
    GENERATED_BODY()


You need to export the UBasicPawnInterface as well:


// This class does not need to be modified.
UINTERFACE(Blueprintable)
class BASICFRAMEWORK_API UBasicPawnInterface : public UInterface
{
GENERATED_BODY()
};