I’m using UE4.23 and Visual Studio 2017. I find that, in the unreal visual studio project, all warnings are treated as errors. And I don’t know how to suppress all warnings.
For example, in a C++ class constructor, a variable is declared and is not used:
AMyActor::AMyActor()
{
int a; // unused variable
}
and I get this error :
error C4101: "a" : unreferenced local variable
This makes me confused, because C4101 is a level 3 warning.
Then I try to suppress this warning by using the warning level [FONT=courier new]\W2 :
AMyActor::AMyActor()
{
#pragma warning(push, 2) // set the warning level to 2
int a;
#pragma warning(pop)
}
but this doesn’t work. BTW, [FONT=courier new]#pragma warning(push, 0) doesn’t work neither.
Then I try to set C4101 to default warning level, and it works:
AMyActor::AMyActor()
{
#pragma warning(push, 2)
#pragma warning(default, 4101) // set C4101 to default warning level
int a;
#pragma warning(pop)
}
It seems that the warning level of every warning has been changed, why?
I want to suppress all warnings, what should I do? Or how can I set all warnings to their default warning levels?
I have added arguments [FONT=courier new]\W0 and [FONT=courier new]\WX- in the [FONT=courier new]*.response file for [FONT=courier new]cl.exe, it doesn’t work neither.
I have removed the argument [FONT=courier new]-WarningsAsErrors for UBT, it doesn’t work neither.