Indentifier "TextButton" is undefined

Hi,

I created a basic audio GUI project and tried to make a button appear on the window. As you can see from the screenshot, the modules required to make it work are included but getting an error that “Indentifier TextButton is undefined”. Please help I am not sure what is missing !!!

When I specified namespace then it appeared.

juce::TextButton playButton;

In the Projucer settings section you have an option to add “using namespace juce” to JuceHeader.h in case you don’t want to manually include the namespace each time.

Thank You.

juce::TextButton

i typically tend to avoid using the command

using namespace *namespace*

if you need to shorten your typing for specific functions you use often, you can do something like

using textButton = juce::TextButton;
using gain = juce::dsp::Gain<float>;
using filter = juce::dsp::IIR::Filter<float>;

this makes it a billion times faster and your code looks cleaner

That’s technically possible, but I would adhere to the conventions, which is to keep the types/class names in capitals.
You want your code to blend in, and a fellow reader should not stumble when reading.

Thanks to auto complete it’s not too much typing, and using almost always auto helps a lot as well.

2 Likes