I’m writing a C++ code for ActorComponent. When I’m trying to debug function in Visual Studio breakpoints in functions that have arguments do not get hit. Neither can i step into these functions.
for example function:
void UInventorySystem::TestFunctionForDebugger()
{
for (int i = 0; i < 5; i++)
{
UE_LOG(LogTemp, Log, TEXT("The value of int is: %d"), i);
}
}
Debugs fine. But once i add an argument
void UInventorySystem::TestFunctionForDebugger(int test_int)
{
for (int i = 0; i < test_int; i++)
{
UE_LOG(LogTemp, Log, TEXT("The value of int is: %d"), i);
}
}
It’s probably due to compiler optimizations. You can disable them in your build file
// PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; // <= comment out
// Do not use PCH or Unity builds,
PCHUsage = ModuleRules.PCHUsageMode.NoPCHs;
// Nor Optimization, since intrinsics clash with those options :/
OptimizeCode = CodeOptimization.Never;
Just make sure to enable them before you pack & ship your game.
For some reason adding this to Build.cs broke the project. When i’m trying to build it throws lots of errors that i haven’t seen before like this one: InventorySystem.h(23): error C2143: syntax error: missing ';' before '*'