Call component function from another component
Posted: Sun Jan 24, 2021 5:16 pm
Hi,
I am having difficulties to call a function in a component from another component. Is it possible to call function in a component from another component? i have use static, extern, pointer call but all getting the same error.
I am able to call the component in project main files but when i call from other component i am getting :
example:
component A.h:
component B.h:
component A.cpp:
Basically i want to have the component function as static and able to call it in any files from other components.
Thank you.
I am having difficulties to call a function in a component from another component. Is it possible to call function in a component from another component? i have use static, extern, pointer call but all getting the same error.
I am able to call the component in project main files but when i call from other component i am getting :
Code: Select all
undefined reference to B::init(). in function `A::init()'
component A.h:
Code: Select all
class A
{
public:
A(){};
static init();
}
Code: Select all
class B
{
B(){};
static init();
}
Code: Select all
B b;
init(){
b.init(); // error
or
B::init(); // error
}
Thank you.