Hi,
I am trying to use a C++ library (TimPr) that will read data of a sensor in unreal engine blueprint.
What I did so far is that I linked the headers and static library of this C++ library(TimPr) and then I created a C++ class based on BlueprintFunctionLibrary class and named it BPFL.
Inside the BPFL.h, I added the following code.
#include “TimPr.h”
UFUNCTION(BlueprintCallable)
static TimPr* ReturnAPointerToTimPrObject(float inputDataForTimPrConstructor);
// the TimPr object has a function member that return its data member float. (GetData()).
UFUNCTION(BlueprintCallable)
static float ReturnDataValueOfGivenPointerObject(TimPr* PointerToTimPr);
Inside BPFL.CPP I added the following code:
#include “BPFL.h”
TimPr* UBPFL:: ReturnAPointerToTimPrObject(float inputDataForTimPrConstructor)
{
TimPr ObjectOfTimPr(inputDataForTimPrConstructor);
TimPr* PTimPr = &ObjectOfTimPr;
return PTimPr;
}
float UBPFL::ReturnDataValueOfGivenPointerObject(TimPr* PointerToTimPr)
{
return PointerToTimPr->GetData();
}
Now when I try to build the project I get following errors:
1)Unrecognized type ‘TimPr’ - type must be a UCLASS, USTRUCT or UENUM.
2)Error MSB3073 The command ““C:\Program Files\Epic Games\UE_4.26\Engine\Build\BatchFiles\Build.bat” LastDayOfWeekEditor Win64 Development -Project=“C:\Users\meysam.imanipour\UE\LastDayOfWeek\LastDayOfWeek.uproject” -WaitMutex -FromMsBuild” exited with code 6. LastDayOfWeek C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets
==============================================================================
What I want is to be able to use a function of this TimPr class which is a function member so I thought for this solution to create two static member function inside the BPFL class that one of them create an object instance and return a pointer to it, and the other function use this pointer to access the function member of the the TimPr class. I could do This in C++ but I don’t know what is the problem here.
I appreciate your help,
Thanks.