If I understand you correctly:
load120 is a public member function of Janela120, so it can only be called using an object of type Janela120.
I don't see the source code for load120, so I can only assume it is declared correctly (meaning it actually does need a Janela120 object in order to do its job. Otherwise, it would be better to make it a static member function.)
win120 is a local variable in the function main() so it can't be used anywhere else. Did you maybe intend win120 to be a global variable?
Quote:
Originally Posted by Luis Navarro
Code:
void Janela000::click_in_b1(void) // routine where I need to call load120
|
So you want to call load120 from a member function of another class and that other class is not derived from the class in which load120 is declared.
Quote:
Code:
load120(); // call to load the 120 window (problem is here?)
|
Nothing there provides the needed object.
Quote:
I've tried to put in wp000.cpp module an statement like (several different tries):
extern void load120(void);
|
That declares a different load120, which you never defined, so the compiler will let you call it, but the linker won't find it.
Quote:
extern void Janela120::load120(void);
or
extern void Janela120::win120->load120(void);
or
extern void win120->load120(void);
|
All garbage.
Would be OK if win120 were global. But win120 is a local variable in main().
Quote:
or with
Janela120::load120();
|
Would be OK if load120 were a static function in that class, but a non static member function requires an object.
Quote:
or with
Janela120::win120->load120();
|
Would be OK if win120 were declared, defined and initialized as a static pointer in that class (which is a common way of managing this sort of situation) but I can't tell if that is what you want and anyway it isn't what you did.
BTW, I haven't programmed anything in QT. I expect QT has some usual form for dealing with this issue (accessing methods inside a widget from somewhere outside that widget). What I told you is how one might deal with this issue in ordinary C++. That might or might not be a good answer for QT.