# Treat warning as errors

**URL:** <https://forums.unrealengine.com/t/treat-warning-as-errors/309510>\
**Category:** C++\
**Tags:** warnings, unreal-engine, CPP, question\
**Created:** [March 5, 2015, 11:12pm UTC](https://forums.unrealengine.com/t/treat-warning-as-errors/309510 "2015-03-05T23:12:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_3faab992](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3faab992](https://forums.unrealengine.com/u/anonymous_user_3faab992)\
**Post date:** [March 5, 2015, 11:12pm UTC](https://forums.unrealengine.com/t/treat-warning-as-errors/309510/1 "2015-03-05T23:12:23Z")

</div>

UBT refuses to build my project because one of the headers I have included causes a warning.  
Is there a way to disable to compiler flag without rebuilding UBT or the engine with vs2013?

---

<div class="post-metadata">

**Author:** ![IdentityCrisisUK](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@IdentityCrisisUK](https://forums.unrealengine.com/u/IdentityCrisisUK)\
**Post date:** [March 9, 2015, 10:58am UTC](https://forums.unrealengine.com/t/treat-warning-as-errors/309510/2 "2015-03-09T10:58:28Z")

</div>

The approach we normally take internally if we absolutely cannot fix a warning is to add:

```
#pragma warning(disable: <warning code>)

```

Before the offending header. We don’t generally run completely without warnings. If you still want to check for that warning in other code you may want to wrap it with #pragma warning(push) and #pragma warning(pop) statements.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3faab992](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3faab992](https://forums.unrealengine.com/u/anonymous_user_3faab992)\
**Post date:** [March 9, 2015, 1:23pm UTC](https://forums.unrealengine.com/t/treat-warning-as-errors/309510/3 "2015-03-09T13:23:45Z")

</div>

Yup. this will do. Thanks.

---

<div class="post-metadata">

**Author:** ![bvisness](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bvisness](https://forums.unrealengine.com/u/bvisness)\
**Post date:** [July 23, 2016, 9:01pm UTC](https://forums.unrealengine.com/t/treat-warning-as-errors/309510/4 "2016-07-23T21:01:21Z")

</div>

Also note that you should just include the numeric part of the error code. If your code is “C1234” do “#pragma warning(disable: 1234)”.
