Multiple RPC objects in Arduino?

I created an RPC object in Arduino as follows:

openmv::rpc_hardware_serial1_uart_master interface(115200);

That works fine. However, when I try to use that interface in a different .cpp file (within a function), I get an error telling me that ‘interface was not declared’.

So, I tried creating a different RPC object as follows:

openmv::rpc_hardware_serial1_uart_master mem_interface(115200);

When I try:

mem_interface.begin();

‘mem_interface’ is not recognized as a type.

Is it possible to create multiple RPC objects? If not, how can I use my ‘interface’ in other functions in other .cpp files?

Hi Peter,

It sounds like you are having issues with how C/C++ work. Please use Google or ChatGPT to answer your questions more quickly in this case.

Anyway, you need to extern the class name if you want to access it in a different file.

‘mem_interface’ is not recognized as a type.

This is a compiler error where the real error is hidden behind a secondary error. Something is wrong with that declaration and you are getting a second error about the mem_interface missing because the first error caused it to not be created.

Thank you! I knew it was a compile issue, and thought I’d ask on here first to see if anyone had a quick answer before scouring the internet. I appreciate the quick response.