Announcement

Collapse
No announcement yet.

Compile Error

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

    Compile Error

    I'm getting a compile error that's making me pull my hair out. I suspect it's something simple, but I can't seem to figure it out.

    I have a subclass of ACharacter called ABaseNPCCharacter, which has a lot of generic code to determine things like LOS, nearby friend and enemies, etc.

    There are two subclasses of ABaseNPCCharacter (AEnemyCharacter and AFriendCharacter), but as of right now they are empty subclasses except they add a tag to the Actor's Tag array.

    All was well until I went to override PostInitializeComponents() in ABaseNPCCharacter.

    I added this to ABaseNPCCharacter.h:

    Code:
    virtual void PostInitializeComponents() override;
    and this to ABaseNPCCharacter.cp:

    Code:
    void ABaseNPCCharacter::PostInitializeComponents()
    {
        Super::PostInitializeComponents();
        
        if (WaypointAutoBuildTag != NULL)
        {
            // TODO: Build waypoint array from tag
        }
        
    }
    Basically, just a stub for future functionality. When I go to compile, I get this result, though;

    Code:
    [11/11] Link UE4Editor-RepublicSniperAI-Mac-DebugGame.dylib
    Undefined symbols for architecture x86_64:
      "ABaseNPCCharacter::PostInitializeComponents()", referenced from:
          vtable for AEnemyCharacter in EnemyCharacter.cpp.o
          vtable for AFriendCharacter in FriendCharacter.cpp.o
      "vtable for ABaseNPCCharacter", referenced from:
          ABaseNPCCharacter::ABaseNPCCharacter(FPostConstructInitializeProperties const&) in BaseNPCCharacter.cpp.o
          ABaseNPCCharacter::~ABaseNPCCharacter() in EnemyCharacter.cpp.o
          ABaseNPCCharacter::~ABaseNPCCharacter() in FriendCharacter.cpp.o
      NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    -------- End Detailed Actions Stats -----------------------------------------------------------
    ERROR: UBT ERROR: Failed to produce item: /Users/jeff/Dropbox (MartianCraft)/RepublicSniperAI/Binaries/Mac/UE4Editor-RepublicSniperAI-Mac-DebugGame.dylib
    Cumulative action seconds (8 processors): 0.00 building projects, 55.85 compiling, 0.00 creating app bundles, 0.00 generating debug info, 0.17 linking, 0.00 other
    UBT execution time: 14.11 seconds
    Command /Users/Shared/UnrealEngine/4.4/Engine/Build/BatchFiles/Mac/RocketBuild.sh failed with exit code 2
    I've tried a bunch of permuatations, including also adding overrides to the child classes, but nothing seems to get rid of this message. I've very confused, because neither AFriendCharacter or AEnemyCharacter implements a destructor.

    Please, if anyone knows what boneheaded thing I'm doing here, I'd love to be pointed in the right direction.

    Thanks!
    Jeff

    #2
    The code looks right and I event tried it out (Using VS2013 Update 4).

    Unless the problem is else where in the header, perhaps it's something to do with your compiler setup? http://lists.cs.uiuc.edu/pipermail/c...il/020637.html

    Comment


      #3
      Hmm.... I've tried both GCC and LLVM as my C++ compiler, I've tried C++14 and C++11 (both GNU and LLVM's library) in addition to the compiler default value. I even tried C++98. I've also tried every stdlib option I can think of.

      My C++ is a little rusty, admittedly, but this is making me feel downright stupid.

      Comment


        #4
        Well I'm stumped. This perhaps needs someone with a Mac to try out.

        I remember when developing iOS apps in C++ the file extension made a huge difference. Perhaps try .cpp But that was making sure Objective-C and C++ play nice. Yup scrapping the bottom of the barrel here...

        Other than that... perhaps post your entire header file? But I doubt it'll help.

        I'm guessing it's an obscure environmental issue.

        Hopefully someone working on a Mac can chime in.

        Edit: Trust me you're not stupid.
        Last edited by Bino; 10-01-2014, 05:10 PM.

        Comment

        Working...
        X