JUCE+QT: emit in juce_MidiMessageSequence.cpp conflict

I have a QT Application where we use JUCE as audio playback engine.
The juce part is in a separate library, but I still get errors building the juce_audio_basics module. It seems the preprocessor defines emit for QTs signal slot mechanism.
What is weird is, that in this TU no QT is used, it is all JUCE vanilla.

Renaming emit solves the issue.
Would it be possible to rename those three methods to something else?
Those methods are not part of the public API anyway.

Thanks for your help

maybe a #undef emit before including juce is enough ?

I’m not familiar with QT, so I’m not sure how emit ends up getting compiled - is it substituted by the normal C++ preprocessor, or by QT’s moc? If the latter, is it possible to update your build system so that moc only runs on QT sources, and not on JUCE TUs?

Thanks @otristan,

I was thinking of undef, but was hesitant to add it to my juce-config.h. When the emit was able to creep into the juce module TU, it might have also an adverse effect towards the other code.

However adding this to my juce_audio_basics_source.cpp (manually created stub for the module) solves the issue:

#include "stdafx.h"

#ifdef emit
#undef emit
#endif

#include "juce_config.h"
#include "../../../ThirdParties/JUCE/modules/juce_audio_basics/juce_audio_basics.cpp"

@reuk thanks, there is indeed a config option in the qmake pro file:

CONFIG += no_keywords

But it didn’t have the desired effect.

But this fix works for me, thank you both!