x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Linking errors when inheriting USphereComponent

I have the following two files:

 #pragma once
 
 #include "Components/SphereComponent.h"
 #include "BallSphereComponent.generated.h"
 
 /**
  * The ball's spherical collision component. The ball gets modelled as a perfect sphere regarding collision.
  */
 UCLASS()
 class UBallSphereComponent : public USphereComponent
 {
     GENERATED_UCLASS_BODY()
 };

and

 #include "MyGame.h"
 #include "BallSphereComponent.h"
 
 
 UBallSphereComponent::UBallSphereComponent(const class FPostConstructInitializeProperties& PCIP)
     : Super(PCIP)
 {
 
 }

Which give me the following linking errors:

 BallSphereComponent.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)

 BallSphereComponent.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class UBodySetup * __cdecl UShapeComponent::GetBodySetup(void)" (?GetBodySetup@UShapeComponent@@UEAAPEAVUBodySetup@@XZ)

 BallSphereComponent.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UShapeComponent::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@UShapeComponent@@UEAAXAEAUFPropertyChangedEvent@@@Z)

Inheriting from any other component works fine. This is in UE 4.2, and apparantly these linking errors should have been fixed? I only found one other post with this problem, but that wasof no help at all.

Product Version: Not Selected
Tags:
more ▼

asked Jul 01 '14 at 01:57 PM in C++ Programming

avatar image

Shammah
365 21 18 143

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

cross-post from [this questionHi!

I've checked the logs and it appears that UShapeComponent wasn't marked as ENGINE_API until May 22nd, which looks like it just missed the 4.2 branch :( The commit I was referring to before which was intended to fix the issue looks like it missed one of the base classes (it's here).

If you want to make this work for now, feel free to cherry-pick this commit into your 4.2 checkout.

more ▼

answered Jul 07 '14 at 08:35 AM

avatar image

BrɑκеPɑd STAFF
1.4k 33 22 78

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question