Hey Guys,
im new in C++ and Juce.
Can you help me, cause i stuck trying building a simple Window with Userinterface to Calculate some Numbers.
I start off with a new Project form Projucer and say Gui Application.
I want a simple Slider that does something when its changed.
Here is my Code:
Main.cpp (is unchanged, just the Original from the Autocreated File from Projucer. Main.cpp (3.9 KB)
Here the MainComponent.h
Added the public Slider::Listener Class
The Void function with override
And in the private Section my Variables, included the Slider verbrauchInput; which is the Slider i want to make a Listener. MainComponent.h (1.1 KB)
And here the MainComponent.cpp
Added here the Variables and the function for the sliderValueChanged (which is still empty, but should not the Problem right? MainComponent.cpp (1.7 KB)
If i try to build this it gives me following Errors:
Cause in the Basic tutorials from the Juce Website, they allways work without a Headerfile, and include the Slider::Listener directly in the MainComponent.cpp
That works with no Bugs in my System as well.
Working on Mac OSX 10.11.6 , XCode 7.2
Appreciate Tips and Tricks, and hope you can help me.
so if i add a Listener in the Headfile, i need to tell in the cpp file in which Class to find the function, in that case the ine MainContentComponent - Class, right?
Has nothing to do with inheriting from / implementing the SliderListener… Also not in which class to find the function, it’s about in which class to fill in the function. The header file just ‘declares’ it, like, this is going to exist and do something in the final program. The .cpp side gives the function its true content, behaviour. The header is just the skeleton (‘signature’). Because the .cpp file is quite loose from the .h file, one will need to scope everything in there with the class name. Very easy to make this mistake and also not easy to get from the error messages that this is what was wrong. It helps to try and have a strict way of copy pasting the function and then putting the class scope immediately in the .cpp.