Download

UE_LOG won't work in 4.4.3 with included Engine.h

Hi, in vehicle blueprint template game i made new actor based class and try use UE_LOG from .cpp file, but get couple of error, .cpp file contain next things:

include “Twisted_cars.h”
include “Engine.h”
include “SimpleSteamIntegrationClass.h”
ASimpleSteamIntegrationClass::ASimpleSteamIntegrationClass(const class FPostConstructInitializeProperties& PCIP) : Super(PCIP) { UE_LOG(YourLog, Warning, TEXT(“test”)); }

errors are:

Error 2 error C2653: ‘FLogCategoryYourLog’ : is not a class or namespace name
Error 3 error C2065: ‘CompileTimeVerbosity’ : undeclared identifier
Error 4 error C2065: ‘YourLog’ : undeclared identifier
Error 5 error C2228: left of ‘.IsSuppressed’ must have class/struct/union
Error 6 error C2228: left of ‘.GetCategoryName’ must have class/struct/union
Error 7 error C2660: ‘FMsg::Logf’ : function does not take 4 arguments

Any idea how solve it?

When using custom LogCategorys you need to define them with:



//In .h file
DECLARE_LOG_CATEGORY_EXTERN(YourLog, Log, All);
//In .cpp file
DEFINE_LOG_CATEGORY(YourLog);


As stated here: A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums
Since it says “undeclared identifier” I’d suppose that you didn’t do that.

But usually it’s sufficient to simply use LogTemp as category:



UE_LOG(LogTemp, Warning, TEXT("test"));


Ty, my bad i miss quick usage :smiley: