0
\$\begingroup\$

I've had little luck googling and it takes about an hour to build the engine (which I have to do if I'm to test if it works), so guessing is a bit time consuming.

I've seen advice to add the '/WX' flag to *.target.cs, as well to one of the functions in VCToolChain.cs, but I wasn't able to make it work.

Has anyone here enabled this and knows how it works? I don't think it matters, but I've been using VS2017.

\$\endgroup\$
1
\$\begingroup\$

Assumptions

  • You're building the Unreal Engine from the github source.
  • You're on Windows 10.
  • Instructions from Visual Studio 2019 Community Edition are similar to those for VS2017.

Solution

The advice you got regarding /WX option is correct, but I don't think the *.target.cs file was the proper place to put it. I see hints that there is a variable to append additional command-line options in that file, but nothing solid. Also, since there are multiple targets that you can build, I figured the following is the safest way to go.

Steps

  1. Open the solution, UE4.sln.
  2. Right-click on the project UE4 > Properties.
  3. Go to Configuration Properties > NMake > Additional Options.
  4. Append /WX to the list of options already there. enter image description here
  5. Press Okay and rerun your build.

Hope that solves your problem!

Additional Notes

The solution here configures msbuild to build the Unreal Engine binaries. Once you have those binaries build, the Unreal Build Tool (UBT) binary is used to build your UE-specific code (instead of msbuild). The configured UBT command treats warnings-as-errors by default.

References

MSVC Compiler Options > Warning Levels

Understanding Unreal Build Tool

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.