Announcement

Collapse
No announcement yet.

ADetourCrowdAIController in C++

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ADetourCrowdAIController in C++

    I want to inherit my ai controller form ADetourCrowdAIController, but error LNK2019 happens.

    AIModule has been added to the project settings(both .build.cs and .uproject), but error still exists, does anyone know how to solve this?

    UCLASS()
    class WOP_API AWOP_AIController_Base: public ADetourCrowdAIController

    1>WOP_AIController_Base.cpp.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl ADetourCrowdAIController::ADetourCrowdAIController(class FObjectInitializer const &)" (??0ADetourCrowdAIController@@QEAA@AEBVFObjectInitializer@@@Z),该符号在函数 "public: __cdecl AWOP_AIController_Base::AWOP_AIController_Base(class FObjectInitializer const &)" (??0AWOP_AIController_Base@@QEAA@AEBVFObjectInitializer@@@Z) 中被引用
    1>WOP2.generated.cpp.obj : error LNK2019: 无法解析的外部符号 "private: static class UClass * __cdecl ADetourCrowdAIController::GetPrivateStaticClass(wchar_t const *)" (?GetPrivateStaticClass@ADetourCrowdAIController@@CAPEAVUClass@@PEB_W@Z),该符号在函数 "public: static class UClass * __cdecl ADetourCrowdAIController::StaticClass(void)" (?StaticClass@ADetourCrowdAIController@@SAPEAVUClass@@XZ) 中被引用
    1>WOP2.generated.cpp.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl ADetourCrowdAIController::ADetourCrowdAIController(class FVTableHelper &)" (??0ADetourCrowdAIController@@QEAA@AEAVFVTableHelper@@@Z),该符号在函数 "public: __cdecl AWOP_AIController_Base::AWOP_AIController_Base(class FVTableHelper &)" (??0AWOP_AIController_Base@@QEAA@AEAVFVTableHelper@@@Z) 中被引用


    but when I tried the shipping settings in VS, the build was successful.

  • #2
    I have found a another way. Instead of inheriting from ADetourCrowdAIController, I add : Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent"))) to my constructor.

    https://docs.unrealengine.com/latest...fig/index.html.

    Comment


    • #3
      I realise this post is from a while back and you found an alternative, but if anyone else comes across it the reason for the link errors is that ADetourCrowdAIController is missing the AI Module API macro in it's header:

      class AIMODULE_API ADetourCrowdAIController : public AAIController

      Comment

      Working...
      X