I'm trying to compile a small test program which uses JUCE along with FLTK (http://www.fltk.org/), both latest versions, on Ubuntu 14.04 with gcc 4.8.4. Unfortunately I get this error:
In file included from /usr/include/X11/Xlib.h:44:0, from /usr/local/include/FL/fl_utf8.h:63, from /usr/local/include/FL/Fl.H:30, from main-fltk.cc:3: modules/juce_audio_processors/../juce_gui_basics/keyboard/juce_KeyPress.h:37:17: error: expected identifier before numeric constant class JUCE_API KeyPress ^ modules/juce_audio_processors/../juce_gui_basics/keyboard/juce_KeyPress.h:37:17: error: expected unqualified-id before numeric constant main-fltk.cc:14:1: error: expected ‘}’ at end of input } ^
The include order is as follow:
#include "JuceHeader.h" <--- which in turn includes AppConfig.h #include <FL/Fl.H> <--- FLTK stuff #include <FL/Fl_Window.H> <--- FLTK stuff
The app compiles fine if I remove FLTK includes: I'm quite sure there's some name clashing here... To solve it, just do
#include <FL/Fl.H> #include <FL/Fl_Window.H> #undef KeyPress <--- add this #include "JuceHeader.h"
Smarter solutions are welcome :)