Disable -Werror

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

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

Hi @ben.o

Could you try overriding the compiler flags using the

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

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
}