dankrusi
(dankrusi)
February 19, 2025, 8:45pm
1
I must be too tired or something, but for the life of me I can’t figure out how to link a simple inheriting class AMyChaosSolverActor?
I always get linking errors such as when I call the base class functions:
error LNK2019: unresolved external symbol "public: virtual void __cdecl AChaosSolverActor::BuildSimulationProxy(void)" (?BuildSimulationProxy@AChaosSolverActor@@UEAAXXZ) referenced in function "public: virtual void __cdecl AMyChaosSolverActor::BuildSimulationProxy(void)" (?BuildSimulationProxy@AMyChaosSolverActor@@UEAAXXZ)
MyChaosSolverActor.h:
#pragma once
#include "CoreMinimal.h"
#include "Chaos/ChaosSolverActor.h"
#include "MyChaosSolverActor.generated.h"
/**
*
*/
UCLASS()
class CHAOSCPPTESTS_API AMyChaosSolverActor : public AChaosSolverActor
{
GENERATED_BODY()
public:
// Required virtual function implementations
virtual void BuildSimulationProxy() override;
virtual void ResetSimulationProxy() override;
virtual void WriteToSimulation(float DeltaTime, bool bAsyncTask) override;
virtual void ReadFromSimulation(float DeltaTime, bool bAsyncTask) override;
// Required by IDataflowSimulationInterface
virtual void PreProcessSimulation(float DeltaTime) override;
virtual void PostProcessSimulation(float DeltaTime) override;
// Required by IDataflowPhysicsSolverInterface
virtual FString GetSimulationType() const override;
};
MyChaosSolverActor.cpp:
#include "MyChaosSolverActor.h"
#include "Chaos/ChaosSolverActor.h"
void AMyChaosSolverActor::BuildSimulationProxy()
{
Super::BuildSimulationProxy(); // <-- Super call causing link error
}
void AMyChaosSolverActor::ResetSimulationProxy()
{
}
void AMyChaosSolverActor::WriteToSimulation(float DeltaTime, bool bAsyncTask)
{
}
void AMyChaosSolverActor::ReadFromSimulation(float DeltaTime, bool bAsyncTask)
{
}
void AMyChaosSolverActor::PreProcessSimulation(float DeltaTime)
{
}
void AMyChaosSolverActor::PostProcessSimulation(float DeltaTime)
{
}
FString AMyChaosSolverActor::GetSimulationType() const
{
return FString(TEXT("CustomChaosSolver"));
}
Build.cs:
using UnrealBuildTool;
public class ChaosCPPTests : ModuleRules
{
public ChaosCPPTests(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput", "ChaosSolverEngine" });
PrivateDependencyModuleNames.AddRange(new string[] { });
}
}
Thanks a lot for you help, and sorry if I missed something basic.
dankrusi
(dankrusi)
February 19, 2025, 9:09pm
2
To save you some time:
ChaosSolverActor.h:
~~~~
//~ Begin IDataflowPhysicsSolverInterface interface
virtual FString GetSimulationName() const override {return GetName();};
virtual FDataflowSimulationAsset& GetSimulationAsset() override {return SimulationAsset;};
virtual const FDataflowSimulationAsset& GetSimulationAsset() const override {return SimulationAsset;};
virtual FDataflowSimulationProxy* GetSimulationProxy() override {return &RigidSolverProxy;}
virtual const FDataflowSimulationProxy* GetSimulationProxy() const override {return &RigidSolverProxy;}
virtual void BuildSimulationProxy() override;
virtual void ResetSimulationProxy() override;
virtual void WriteToSimulation(const float DeltaTime, const bool bAsyncTask) override;
virtual void ReadFromSimulation(const float DeltaTime, const bool bAsyncTask) override;
//~ End IDataflowPhysicsSolverInterface interface
~~~~
The method BuildSimulationProxy() is implemented by ChaosSolverActor.
3dRaven
(3dRaven)
February 19, 2025, 9:24pm
3
Not sure if you copied over the rest of the overrides from your last message.
Adding this to the header, copied over from AChaosSolverActor into AMyChaosSolverActor gives a successful compile
virtual FString GetSimulationName() const override { return GetName(); };
virtual FDataflowSimulationAsset& GetSimulationAsset() override { return SimulationAsset; };
virtual const FDataflowSimulationAsset& GetSimulationAsset() const override { return SimulationAsset; };
virtual FDataflowSimulationProxy* GetSimulationProxy() override { return &RigidSolverProxy; }
virtual const FDataflowSimulationProxy* GetSimulationProxy() const override { return &RigidSolverProxy; }
MyChaosSolverActor.h (1.4 KB)
MyChaosSolverActor.cpp (744 Bytes)
dankrusi
(dankrusi)
February 27, 2025, 8:09am
4
Many thanks for your help!
Yes sorry - I trimmed away a bit too much, ofcourse I also have those methods.
I’m not sure how you are able to compile - things like SimulationAsset are private to ChaosSolverActor (I am on UE 5.5).
If I change from Super to AChaosSolverActor, I can call those AChaosSolverActor methods which are inline in the header (like AChaosSolverActor::GetSimulationAsset()), however I still can’t link to other methods like AChaosSolverActor::BuildSimulationProxy():
error LNK2019: unresolved external symbol "public: virtual void __cdecl AChaosSolverActor::BuildSimulationProxy(void)" (?BuildSimulationProxy@AChaosSolverActor@@UEAAXXZ) referenced in function "public: virtual void __cdecl AMyChaosSolverActor::BuildSimulationProxy(void)" (?BuildSimulationProxy@AMyChaosSolverActor@@UEAAXXZ)
I don’t understand why the one works and the other doesn’t - the only difference being that
AChaosSolverActor::GetSimulationAsset() is inline in the header.
Is it because these are marked as CHAOSSOLVERENGINE_API (__declspec)?
Thanks for your help in understanding how to properly extend engine actors and components, without modifying engine source directly.
Here is a test class:
UCLASS()
class CHAOSTESTS_API AMyChaosSolverActor : public AChaosSolverActor
{
GENERATED_BODY()
public:
//~ Begin IDataflowPhysicsSolverInterface interface
virtual FString GetSimulationName() const override { return GetName(); };
virtual FDataflowSimulationAsset& GetSimulationAsset() override { return AChaosSolverActor::GetSimulationAsset(); };
virtual const FDataflowSimulationAsset& GetSimulationAsset() const override { return AChaosSolverActor::GetSimulationAsset(); };
virtual FDataflowSimulationProxy* GetSimulationProxy() override { return AChaosSolverActor::GetSimulationProxy(); }
virtual const FDataflowSimulationProxy* GetSimulationProxy() const override { return AChaosSolverActor::GetSimulationProxy(); }
virtual void BuildSimulationProxy() override { AChaosSolverActor::BuildSimulationProxy(); }; // causes linker issue
virtual void ResetSimulationProxy() override {};
virtual void WriteToSimulation(const float DeltaTime, const bool bAsyncTask) override {};
virtual void ReadFromSimulation(const float DeltaTime, const bool bAsyncTask) override {};
//~ End IDataflowPhysicsSolverInterface interface
// Required by IDataflowSimulationInterface
virtual void PreProcessSimulation(float DeltaTime) override { };
virtual void PostProcessSimulation(float DeltaTime) override {};
// Required by IDataflowPhysicsSolverInterface
virtual FString GetSimulationType() const override { return GetName(); };
};
Hi,
Yes, these method’s symbols are not exported as you noticed. That is the reason why you can’t call them from an external (your) module.
Sadly, I don’t think there is much you can do other than modifying the engine to export them by adding CHAOSSOLVERENGINE_API.
I also suggest checking that the module where you class lives, has ChaosSolverEngine as dependency on its build.cs file, otherwise exporting them will not fix the issue.
dankrusi
(dankrusi)
March 2, 2025, 12:40pm
6
Thanks Sergio, yes indeed some of the methods are not marked as CHAOSSOLVERENGINE_API. I was distracted a bit by some of the interface being exposed, and others not.
I will try to duplicate the ChaosSolverActor functionality without inheriting. Gut feeling is that its probably easier to maintain changes in the engine source than go this route.
BTW: The Chaos Visual Tools / Live Debugger is amazing. Not sure if you are involved with that.
1 Like
Yes, I am the developer of the Chaos Visual Debugger.
So, Thank you!, I am glad you like it (and hopefully it has been useful).
It is still on Beta so expect some rough edges, but for anyone else if you want to give it a try, this is a doc I put together a while ago Chaos Visual Debugger - User Guide for UE 5.5 | Tutorial
system
(system)
Closed
April 1, 2025, 8:26pm
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.