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"

UPhysicsThrusterComponent linker error

Hello,

When attempting to attach a UPhysicsThrusterComponent to an actor e.g.:

 class AExample : public APawn
 {
 public:
     GENERATED_UCLASS_BODY()
 
     UPROPERTY(Category = Physics, VisibleDefaultsOnly, BlueprintReadOnly)
         TSubobjectPtr<class UPhysicsThrusterComponent> Thruster;
 };
 
 AExample::AExample(const class FPostConstructInitializeProperties& PCIP)
 {
     Thruster = PCIP.CreateDefaultSubobject<UPhysicsThrusterComponent>(this, TEXT("Thruster0"));
     Thruster->AttachTo(RootComponent);
 }

You get a linker error:

 error LNK2019: unresolved external symbol "private: static class UClass * __cdecl UPhysicsThrusterComponent::GetPrivateStaticClass(wchar_t const *)" (?GetPrivateStaticClass@UPhysicsThrusterComponent@@CAPEAVUClass@@PEB_W@Z) referenced in function "public: class UPhysicsThrusterComponent * __cdecl FPostConstructInitializeProperties::CreateDefaultSubobject<class UPhysicsThrusterComponent,class UPhysicsThrusterComponent>(class UObject *,class FName,bool,bool,bool)const " (??$CreateDefaultSubobject@VUPhysicsThrusterComponent@@V1@@FPostConstructInitializeProperties@@QEBAPEAVUPhysicsThrusterComponent@@PEAVUObject@@VFName@@_N22@Z)

From discussing with others all I can tell is because potentially the UPhysicsThrusterComponent has not been exposed properly to C++, most likely due to it only anticipated being used in blueprints.

I actually changed the source code to add MinimalAPI onto the Component class definition and it does appear to link correctly, though I'm not sure if this is the correct solution:

 UCLASS(hidecategories = (Object, Mobility, LOD), ClassGroup = Physics, showcategories = Trigger, HeaderGroup = Component, meta = (BlueprintSpawnableComponent), MinimalAPI)
 class UPhysicsThrusterComponent : public USceneComponent

Thanks

Gachuk.

Product Version: Not Selected
Tags:
more ▼

asked May 23 '14 at 10:17 AM in Bug Reports

avatar image

Gachuk
6 1 2 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi Gachuk,

Using MinimalAPI is currently the best option for this issue. What is happening here is that the PhysicsThrusterComponent is in the Engine Module, and is not visible to your Game Module. I will see if there might be anything we can do to make this component a little easier to use.

more ▼

answered Jun 13 '14 at 10:47 PM

avatar image hsrob1 Jun 30 '14 at 12:20 PM

Ah, thank you for looking into this. I just ran into this issue today as well... iterating through the Components on my APawn, and I cannot cast them to UPhysicsThrusterComponent.

avatar image angularsen Sep 10 '14 at 06:19 PM

So, I must be doing something wrong. I added ", MinimalAPI" to the end of the UCLASS definition of PhysicsThrusterComponent.h, just as described in the question. I'm still getting the same linker error. Any ideas? All I want is to work with thrusters in C++.

Using UE 4.3.1. One thing I noted is I got a compile error if I copied & pasted his UCLASS statement entirely, on this part: "HeaderGroup = Component" That was also the only thing that differed from my copy.

Error 2 error LNK2019: unresolved external symbol "private: static class UClass __cdecl UPhysicsThrusterComponent::GetPrivateStaticClass(wchar_t const )" (?GetPrivateStaticClass@UPhysicsThrusterComponent@@CAPEAVUClass@@PEB_W@Z) referenced in function "public: class UPhysicsThrusterComponent __cdecl FPostConstructInitializeProperties::CreateDefaultSubobject (class UObject ,class FName,bool,bool,bool)const " (??$CreateDefaultSubobject@VUPhysicsThrusterComponent@@V1@@FPostConstructInitializeProperties@@QEBAPEAVUPhysicsThrusterComponent@@PEAVUObject@@VFName@@_N22@Z) C:\Users\Andreas\Documents\Unreal Projects\Birds\Intermediate\ProjectFiles\BirdsPawn.cpp.obj Birds

avatar image Tim C ♦♦ STAFF Sep 11 '14 at 03:04 PM

Hi @anjdreas,

Do you also have an include for the PhysicsThrusterComponent? Make sure you have this line in your header file:

 #include "PhysicsEngine/PhysicsThrusterComponent.h"

You don't need to include the HeaderGroup class specifier. That keyword was removed in 4.2 and is no longer recognized by UHT.

avatar image angularsen Sep 11 '14 at 04:50 PM

Thanks, I did not. Somehow I thought it would be included as all the other classes are.

avatar image Meganaut9001 Sep 23 '14 at 08:24 PM

Hi Tim,

Any idea when we might see a fix for this? I can work around it atm using the MinimalAPI trick, but its an issue for our artists who dont necessarily want to compile the full source, to open the project.

Cheers,

avatar image Tim C ♦♦ STAFF Sep 24 '14 at 06:13 PM

Hi Meganaut9001,

I had lost track of this post, sorry about that. I have a feature request entered asking that the PhysicsThrusterComponent be exposed outside of the Engine module. I still do not have any information for when this will happen, though.

avatar image Meganaut9001 Sep 29 '14 at 11:17 AM

Thanks Tim!!

Is there any way I can "watch" that feature request? Otherwise I will keep an eye on the change notes. Cheers,

avatar image [Epic]Ori Cohen STAFF Sep 29 '14 at 02:09 PM

This change is now in main, but won't make it into 4.5 as we've already branched. It should be in 4.6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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