Understanding 4.2 #define GLOBAL MODULE SETTINGS INCLUDED

In Juce 4.2 the #define JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED was introduced.
I understand that it notifies Juce that there was a global header included.

So when updating to 4.2, I put his in my AppConfig.h.
I saw that it was done the same in the 4.2 examples.

Still I got the compiler errors (in VS2015).
A quick fix was putting the #define in preprocessor definitions.

After some time I figured out that opening and saving the project in the Projucer fixes the issue.
But reviewing the changes in source and build files did not clarify what had happened.
Also found nothing like e.g. changed include dir order.
What else “magic” :sparkles: could Projucer do besides adding the #define in appconfig.h?
Or was I just blind? :dizzy_face:

Hmm, yes, that error message could be a bit clearer, TBH, I might update it to suggest that people re-save their projects…

How is that fixed for people not using {Int/P}roJucer?

The comment above the error explains what to do. You just need to set a flag to silence it if you don’t need a global header file

1 Like

Still I’m curious to understand it:
What else does Projucer do but adding the #define JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED to AppConfig.h?
I also can’t find the JUCE_APP_CONFIG_HEADER being used anywhere…

JUCE_APP_CONFIG_HEADER is for people who want to define their own global header file. If you look in juce_TargetPlatform.h, you’ll see that if it’s defined, then that file will be included by all the JUCE modules. That means that if you’re not using the projucer, then you can just set it as a global macro, and add all the module cpp files directly to your project to compile them.

#define JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED 0

Where should this go? If I put it in the user config area of AppConfig, it gets overwritten by the Projucer generated definitions.

The projucer will put it in AppConfig.h for you. There’s no need to ever know about its existence unless you’re using your own custom build system.