Search code examples
c++ubuntugccgcc-warningjuce

How to get compiler warnings JUCE - Ubuntu


I was recently dealing with an error that should have easily been realized with a simple compiler warning.
Does anyone know how to get compiler warnings to show up when compiling JUCE projects with make on Ubuntu?

I attempted:

  • make -Wall from the gcc/gnu Warning Options docs -> no change
  • make V=1 as commented in the makefile -> it was verbose, but didn't show the warnings
  • Editing the live build settings in the Projucer -> live build doesn't work on Ubuntu

Edit: Answered by OMGtechy

To add compiler warnings to the build: edit the Linux Makefile settings in the Exporter tab of the Projucer File Manager (See the picture in his answer). However, I didn't see any "uninitialized variable" warnings until I also ran with the optimization flag -O2. Apparently gcc is bad with that warning.


Solution

  • You want to add -Wallto your exporter compiler flags, possibly with -Werror too. Just adding them to the live build flags will only affect the Projucer's live build feature.

    Where to add the compiler flags