I have recently switched to Unreal, and was going about declaring a log category; though running into some issues.
Prior to posting, I already looked through the forums, finding posts such as:
#520060
#226445
Though unlike the posts above, I believe I have correct syntax and usage from what I have seen (I could be completely wrong as I’m still adjusting to the work environment) though still running into this error:
CompilerResultsLog: ...\Source\FarmQuestCPP\Private\FQAssetManager.cpp(22) : error C2653: 'FLogCategoryFarmQuestCPPLog': is not a class or namespace name
CompilerResultsLog: ...\Source\FarmQuestCPP\Private\FQAssetManager.cpp(22) : error C2065: 'CompileTimeVerbosity': undeclared identifier
CompilerResultsLog: ...\Source\FarmQuestCPP\Private\FQAssetManager.cpp(22) : error C2065: 'FarmQuestCPPLog': undeclared identifier
CompilerResultsLog: ...\Source\FarmQuestCPP\Private\FQAssetManager.cpp(22) : error C2672: 'FMsg::Logf_Internal': no matching overloaded function found
CompilerResultsLog: ...\Source\FarmQuestCPP\Private\FQAssetManager.cpp(22) : error C2780: 'void FMsg::Logf_Internal(const ANSICHAR *,int32,const FName &,ELogVerbosity::Type,const FmtType &,Types...)': expects 6 arguments - 4 provided
CompilerResultsLog: ...\Epic Games\UE_4.21\Engine\Source\Runtime\Core\Public\Logging/LogMacros.h(55): note: see declaration of 'FMsg::Logf_Internal'
Here are the files in question:
FarmQuestCPP.h
#pragma once
#include "CoreMinimal.h"
#include "Engine.h"
FARMQUESTCPP_API DECLARE_LOG_CATEGORY_EXTERN(FarmQuestCPPLog, Log, All);
FarmQuestCPP.cpp
#include "FarmQuestCPP.h"
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, FarmQuestCPP, "FarmQuest" );
/** Logging definitions */
DEFINE_LOG_CATEGORY(FarmQuestCPPLog);
And finally where the error occurs:
FQAssetManager.cpp
UE_LOG(FarmQuestCPPLog, Fatal, TEXT("Error Message!"));
Also I should note, FQAssetManager.h inherits FARMQUESTCPP_API as such:
UCLASS()
class FARMQUESTCPP_API UFQAssetManager : public UAssetManager
If anyone has the time to check everything above to see where and if I messed up. I have been able to circumvent this issue temporarily using LogTemp, though I would like to implement my own categories for logging.
Thank you, and I hope someone is able to help out!