Download

Make aUtility Log class. Getting ChessLog.cpp(16) : error C2065: 'Lmsg': undeclared identifier

Hey folks,

still fresh to unreal engine and c++ in genereal.

I wanted to make a utility class packaging various unreal engine logging functionality.

But cant figure out this error regarding TEXT(std::string x).

error C2065: ‘Lmsg’: undeclared identifier

I tried various includes. Dont wanted it to make a UClass(), but ended here.

.h file


#include "GameFramework/PlayerController.h"
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"

#include "ChessLog.generated.h"

UCLASS()
class CHESS_API UChessLog: public UObject
{

GENERATED_BODY()


public:
UChessLog();
~UChessLog();

void showScreenMessage(std::string msg);
};

.cpp file


#include "ChessLog.h"

UChessLog::UChessLog()
{
}

UChessLog::~UChessLog()
{
}

void UChessLog::showScreenMessage(std::string msg)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT(msg));
}