As programmers, we spend a lot of time bug hunting. It's a sad fact. Finding errors and solving them can often get under our skin, especially if it takes long hours. It's even more difficult when we are flying blind, without instruments to help us navigate through the storm. This is why we should apply great care to set our environment in a way that makes this process as easy and as bearable as possible. We do this by configuring the compiler with target_compile_options(). Which compile options could help us then?

Configuring errors and warnings

There are many great stressful things about software development: fixing critical bugs in the middle of the night, working on high-visibility, costly failures in large systems, and dealing with annoying compilation errors, especially those that are hard to understand or impossibly tedious to fix. When researching a subject in order to simplify our work and reduce the chance of failure, we'll find a lot of recommendations on how to configure the compiler's warnings.

The -Werror flag

Get hands-on with 1200+ tech skills courses.