Hello,
i have a strange bug in Visual Studio. I tried to start a little mathlibary with static functions. But it didnt work out from beginning. First it told me it couldnt find the implentation (source mising or stuff(ais if u have a func-dekleration but no def)). Then after trying around, and do just little things like renaming a class/filename i got an error that the scmath.generated. couldnt get accessed or once it got included twice! i had pragma once in it!
Actually there is a even stranger error. the parent class of the class where i use a static fnction from scmath.h got this error:
fatal error C1189: #error:
“USC_Actor_DecalActor.generated.h
already included, missing ‘#pragma
once’ in USC_Actor_DecalActor.h”
USC_Actor_DecalActor.generated.h(12):fatal error C1189: #error:
“USC_Actor_DecalActor.generated.h
already included, missing ‘#pragma
once’ in USC_Actor_DecalActor.h”
when i remove the class out of my project it compiles like a charm :)(well i have to clean the projectfiles like interdimate and stuff first …)
srly no idea whats the problem causing here…
----h
#pragma once
#include "CoreMinimal.h"
#include "SCMath.generated.h"
/**
*
*/
UCLASS()
class USCMath : public UObject
{
// GENERATED_UCLASS_BODY()
GENERATED_BODY()
public:
USCMath(const FObjectInitializer& ObjectInitializer);
USCMath() {};
// static bool FVector_Angle_CalculateAngleDegreeOn_XYPlane_ToXAxis(FVector &v1, float &fReturn);
bool CalculateAngleDegreeOn_XYPlane(FVector &v1, float &fReturn);
};
—cpp
#include "SCMath.h"
#include "CoreMinimal.h"
#include "Math/UnrealMathUtility.h"
//bool FSMath::FVector_Angle_CalculateAngleDegreeOn_XYPlane_ToXAxis(FVector &v1, float &fReturn)
USCMath::USCMath(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
bool USCMath::CalculateAngleDegreeOn_XYPlane(FVector &v1, float &fReturn)
{
FVector vXAxis = FVector(1, 0, 0);
fReturn = (acosf(FVector::DotProduct(v1, vXAxis)));
if (fReturn > 50 && fReturn < 120)
{
fReturn = fReturn;
}
return true;
// float fAimAtAngle = FMath::RadiansToDegrees(acosf(FVector::DotProduct(v1, v2)));
// fAimAtAngle = acosf(FVector::DotProduct(v1, v1)); // == PI
}