deviceManager error


#1

I haven’t done any programming for years but I used JUCE a while ago to make an audio plugin and it was great. I’m probably being stupid but can someone tell me why the compiler keeps telling me “deviceManager” is undeclared? Here’s the code for the files:

Main.cpp:

#include “…/JuceLibraryCode/JuceHeader.h”
#include “MainComponent.h”

class MainWindow : public DocumentWindow
{
public:
MainWindow() : DocumentWindow (“Synth”,
Colours::lightgrey,
DocumentWindow::allButtons,
true)
{
setContentOwned (new MainComponent (deviceManager), true); [color=#FF0000]error: use of undeclared identifier ‘deviceManager’[/color]

    centreWithSize (getWidth(), getHeight());

    setVisible (true);
}

~MainWindow()
{}

//There’s a bunch of application stuff here too but I don’t think that’s relevant.

};

MainComponent.h:

#include "…/JuceLibraryCode/JuceHeader.h"
class SynthAudioSource;

class MainComponent : public Component,
public ButtonListener
{
public:
MainComponent (AudioDeviceManager& deviceManager_);
~MainComponent();

void paint (Graphics& g);
void resized();
void buttonClicked (Button* buttonThatWasClicked);

private:
Label* mainLabel;
TextButton* quitButton;
Path internalPath1;
AudioDeviceManager& deviceManager;
MidiKeyboardState keyboardState;
AudioSourcePlayer audioSourcePlayer;
ScopedPointer synthAudioSource;

MidiKeyboardComponent* keyboardComponent;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainComponent)

};

Have I done a circular include here or something? Or should I be dealing with deviceManager differently?

Any help would be much appreciated. Cheers.


#2

the error message is pretty clear "error: use of undeclared identifier ‘deviceManager’, so where is deviceManager defined?
If you don’t what i mean, it maybe would be helpful to begin with an c++ tutorial

PS: please use the code-tag for source code in the forum