1

I am coding with Visual Studio and Unreal Engine. Due to the last reason the compilation of the project is driven by the Unreal Build Tool, and it's not possible to me to set the warning level of the project for example.

I have found a solution to my problem to enable each specific warning I want to check in my file by using

#pragma warning(error: ####)

syntax https://learn.microsoft.com/en-us/cpp/preprocessor/warning?view=msvc-160

Nevertheless, I need to specify each single warning I want to check for, whereas I would like to enable all the possible warnings. Is there a way to do so?

giuseppe
  • 184
  • 1
  • 12
  • 1
    `#pragma warning( push, 4 )` (with no matching pop) will set the warning level to 4. I know the compiler supports `/Wall` but I can't see anyway to set this and also it's very noisy. – Richard Critten Oct 15 '21 at 09:44
  • Thanks, unfortunately your solution does not solve my problem, I suppose they are disabled in some file. For example, if I want to spot a float to int implicit conversion warning, I need to add #pragma warning(error: 4244) , using #pragma warning(push, 4) I have either no warning nor error reported during compilation. – giuseppe Oct 16 '21 at 12:19
  • 1
    `4244` is a level 4 warning so should be enabled and is not in the list of warning that are off by default and have to be explicitly enabled https://learn.microsoft.com/en-us/cpp/preprocessor/compiler-warnings-that-are-off-by-default?view=msvc-160 Note it works for me with a small test project and if a file (in your project) is disabling warnings then you have no option but to edit the file and remove the line that suppresses the warning(s). – Richard Critten Oct 16 '21 at 12:45

0 Answers0