JuceHeader.h still the correct thing to include in JUCE 8?

Hi,
I used JUCE 7 for a while and always included JuceHeader.h.
Now I switched to JUCE 8 and I get an error that ToggleButton is not defined.
I’m probably doing something wrong, but I just don’t see it.
I hope someone can help me with this…

the error message is this:
Error (active) E0020 identifier “ToggleButton” is undefined

Note that I also tried to include “modules/juce_gui_basics/juce_gui_basics.h”
But the error remains the same.

#pragma once

#include <JuceHeader.h>

#define SAMPLES_BUF_SIZE 2000

class TimeLine : public juce::Component
{
public:
    //
    TimeLine();
    ~TimeLine() override;

    void paint(juce::Graphics& g) override;
    void resized() override;

    void addSamples(float* samples, int num);

private:

    //
    // GUI components
    //
    ToggleButton mToggleRecord;
 
    //
    // data
    //
    float mCurrMin;
    float mCurrMax;
    int mCurrSamples;
    float mBufferMin[SAMPLES_BUF_SIZE];
    float mBufferMax[SAMPLES_BUF_SIZE];
    int mAddIndex;

    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(TimeLine)
};

What if you write:

juce::ToggleButton mToggleRecord;

Yes off course! That did it. Stupid I didn’t think of that.
But that was not needed in JUCE 7 as far as I know.

Thanks!

Older JUCE a included using namespace juce for you in JuceHeader.h which imported all the juce stuff into the top level namespace.

The right and proper way according to the C++ gods is not to do this, and instead specify juce::. This is considered more holy by the C++ gods.

If you are a lazy irreligious programmer, you can turn probably the using namespace juce thing back on :slight_smile: