Here's a skeleton of my code -
class FLTK_win; //class declaration before full definition so it can be used in the other class
//first of the classes
class functions {
public:
void example_function();
.....
};
void example_function() {
std::string input = FLTK_win::Textbox->value();
/*so here I want to make a string that takes the value of whatever the user has
entered in the text box in the FLTK window class*/
........
}
//second class which is a friend of the first
class FLTK_win : public Fl_Window {
friend class functions;
Fl_Input* Textbox;
......//and the rest of the stuff to open the FLTK window when an instance of the class is created
};
From this line:
std::string input = FLTK_win::Textbox->value();
I get the error:
"incomplete type 'FLTK_win' used in nested name specifier"
I'm wondering whether I have my classes in the wrong order? However I don't see how that would give this error.
Or else there must be a different (proper) way to call the value of an FLTK text box in a different class rather than "FLTK_win::Textbox->value()" ?
I have tried creating an instance of FLTK_win, called testwin within the 'functions' class and then writing:
testwin.Textbox->value();
However I think this doesn't work because the value of the textbox isn't a variable so can't be called in this way. I've also looked into getters & setters but don't understand them enough to know if they are the answer.
Thanks in advance for your help!