Compiler warning using JUCE_LEAK_DETECTOR

Hello,

I have a very weird warinig when compiling some code that uses JUCE_LEAK_DETECTOR on MacOSX:

ld: warning: direct access in juce::LeakedObjectDetector<EventInfo>::getCounter() to global weak symbol guard variable for juce::LeakedObjectDetector<EventInfo>::getCounter()::counter means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

This is the code:

#ifndef EVENTINFO_H_INCLUDED
#define EVENTINFO_H_INCLUDED
class EventInfo
{
public:
    EventInfo();
    
    EventInfo (EventInfo& original);
    
    EventInfo (const EventInfo& original);
    
    void setLabels (const StringPairArray& labels);
    
    void setLabel (const String& name, const String& value);
    
    void removeLabel (const String& name);
    
    void setClientLabels (const String& clientC2, const StringPairArray& labels);
    void setClientLabel (const String& clientC2, const String& name, const String& value);
    
private:
    CriticalSection _objectLock;
    
    StringPairArray _labels;
    
    StringArray _clients;
    Array<StringPairArray> _clientLabels;
    
    const StringPairArray _dummy;
    
    friend class EventManager;
#if UNIT_TESTS
    friend class TestUtils;
#endif
    JUCE_LEAK_DETECTOR (EventInfo);
};
#endif  // EVENTINFO_H_INCLUDED

I'm using it in other places but in this class I'm getting this warning :(

Can anybody help me? Thanks!

That's a down-in-the-bowls kind of error message!  Did you figure it out?  I've never seen it before in my life.  Clean and rebuild maybe - though that's a complete guess!

Cleaning and rebuilding won't help.

To fix this problem inside JUCE, go into the Introjucer settings for that project, select the Xcode (MacOS) and optionally the Xcode (iOS) config, and add the following flag under Extra Compiler Flags:

-fvisibility=hidden

If you're not using Introjucer, make sure that all your C++ source files are being compiled with this option.

Jules, it is possible that this should be the default flag for Xcode builds.

In Xcode there's a build setting for this called "Symbols Hidden by Default" and AFAICT the introjucer does already set this to 'yes'