No member named 'Gain' in 'juce::AudioProcessor' Error

Hi all, I’m using Xcode 11.5 on Catalina 10.15.5 with Juce v6.0.1, when attempting to compile a simple gain slider audio plugin I’m getting the error “No member named ‘Gain’ in ‘juce::AudioProcessor’”, I’ve asked around and looked at other solutions and so far nothing has worked.

Hopefully there is someone in here that has had to deal with a similar issue and has a solution, thanks in advance.

Hi @Thequeensalizard , from not seeing the code, I suspect that you are accidentally using “Gain”, where the member should be “gain”. Members are case sensitive. If that does not solve your problem, please share the code you are working on and I can give it a look.

Hi @jamand , altering the case of the member name doesn’t seem to make a difference, I’ve included a link to the git repo here for you to look at if you’d be so kind.

cheers,

Your repo has no code to look at just an xcode project! A project doesn’t contain code it just references the code from wherever it exists on disk.

Apologies, the new repo has the source files and the Projucer file, please let me know if there’s anything else you need.

So your problem is that processor is a reference to a juce::AudioProcessor which does not contain a member called gain. You’re already initialising a variable of type FaderAudioProcessor& in your constructor which you’ve called audioProcessor, therefore change this…

processor.gain = GainSlider.getValue();

to this…

audioProcessor.gain = GainSlider.getValue();
1 Like

That is perfect thank you! Being new to this field it astonishes me how changing one word or character can solve your problems

Yes, C++ is really nit picky.
Remember that was where I tried to steer your attention on discord, when I asked what type processor actually is :wink:

It’s important to keep in mind, you can always assign to a pointer or reference of a more general type, but not to a more specific type. To achieve that you need to look into dynamic_cast, but that comes at a cost and can fail…

2 Likes