# Disable -Werror

**URL:** <https://forum.legato.io/t/disable-werror/3957>\
**Category:** Legato Application Framework\
**Created:** [December 17, 2018, 6:25pm UTC](https://forum.legato.io/t/disable-werror/3957 "2018-12-17T18:25:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben.o](https://avatars.discourse-cdn.com/v4/letter/b/2bfe46/32.png) [@ben.o](https://forum.legato.io/u/ben.o)\
**Post date:** [December 17, 2018, 6:25pm UTC](https://forum.legato.io/t/disable-werror/3957/1 "2018-12-17T18:25:39Z")

</div>

Hi,

I’m developing a C++ app and need to include Google Protobuf libraries. Unfortunately those libraries produce warnings at compilation, which are treated as error and prevent me to compile.

As I don’t want to edit the Google libs I’m trying to remove the -Werror flag instead.

The problem is I’ve only found how to add flags to the compilation, located in **Properties-\>C/C++ Build-\>Settings-\>Tool Settings-\>C build options**

==\> Is there a way to remove an existing compilation flag?

Ideally I would disable the flag only for those libs so I can keep using it for my c++ files.

As a side question, is there an easier way to include sources files to a component instead of using this pattern?

```
sources:
{
    MyMainEntryPoint.cpp // COMPONENT_INIT
    $SOURCE_PATH/ADirectory/File1.cpp
    $SOURCE_PATH/AnotherDirectory/File2.cpp
    $LIB_PATH/ThisContainsLibs/Lib1.cpp
}

```

Thanks in advance,  
Best regards,  
Ben

---

<div class="post-metadata">

**Author:** ![CoRfr](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/corfr/32/69_2.png) [@CoRfr](https://forum.legato.io/u/CoRfr)\
**Post date:** [December 17, 2018, 7:24pm UTC](https://forum.legato.io/t/disable-werror/3957/2 "2018-12-17T19:24:02Z")

</div>

I wonder if you can add `-Wno-error` to negate `-Werror`.  
I tried it on gcc 8.2 and it works.

---

<div class="post-metadata">

**Author:** ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.legato.io/u/davidc)\
**Post date:** [December 18, 2018, 12:00am UTC](https://forum.legato.io/t/disable-werror/3957/3 "2018-12-18T00:00:03Z")

</div>

Hi @ben.o

Could you try overriding the compiler flags using the

```auto
cflags:
{
}

```

stanza in your Component.cdef file?

Note that I’ve never tried overriding existing flags, only adding additional flags using this method.

You can also add additional flags (cflags or cxxflags) to the entire project build command line using the `-C` and `-X` options to `mkapp`. Again, I’ve never tried to override existing flags.

Maybe try one of these methods to add the `-Wno-error` flag as suggested by @CoRfr?

ciao, Dave

---

<div class="post-metadata">

**Author:** ![ben.o](https://avatars.discourse-cdn.com/v4/letter/b/2bfe46/32.png) [@ben.o](https://forum.legato.io/u/ben.o)\
**Post date:** [December 18, 2018, 9:38am UTC](https://forum.legato.io/t/disable-werror/3957/4 "2018-12-18T09:38:49Z")

</div>

Hello,

Thanks for your help both.

It worked only by using **-Wno-error**.

It worked if I set it for the full project in **Properties-\>C/C++ Build-\>Settings-\>Tool Settings-\>C build options**

It also worked in the component concerned by putting the following in the .cdef file

```
cxxflags:
{
    -Wno-error
}

```
