Macro-less inclusion problem


#1

I could not get The Jucer to compile out of the box.

Seems there is a problem with the macro-less use of juce.h as exemplified in The Jucer application.

“jucer_Headers.h” contains the following lines

//============================================================================== // Normally you'd just include juce.h here, but I'm doing it this way instead // so that I'm guaranteed to spot any bugs that might creep in when using the // macro-free include method.. #include "../../../src/juce_WithoutMacros.h" #include "../../../src/juce_DefineMacros.h"

This gives an error when compiling The Jucer since “juce.h” includes “juce_app_includes.h”, which again includes “juce_ThreadWithProgressWindow.h”, which contains the following
declaration:

ThreadWithProgressWindow (const String& windowTitle, const bool hasProgressBar, const bool hasCancelButton, const int timeOutMsWhenCancelling = 10000, const String& cancelButtonText = T("Cancel"));
The macro T(…) is not defined, which causes an error.

I did a workaround by including juce.h with macros the normal way:

#if 0 //============================================================================== // Normally you'd just include juce.h here, but I'm doing it this way instead // so that I'm guaranteed to spot any bugs that might creep in when using the // macro-free include method.. #include "../../../src/juce_WithoutMacros.h" #include "../../../src/juce_DefineMacros.h" #else // Problem with macro-free includes DID occur. Missing definition of T(...) prior // to inclusion of "juce_ThreadWithProgressWindow.h" #include "../../../juce.h" #endif

Cheers
/nif


#2

Thanks! I wonder why I never hit that one??

The fix is actually just a tweak to juce_ThreadWithProgressWindow.cpp, which I’ve checked-in now.