I'm new in C++, and have been given a (relatively) complex piece of code.
I want to call a function transmit() from a .h file in another .c file.
The transmit() is in the file serviceUart.hpp which content looks like this:
serviceUart.hpp
class ServiceUart
{
public:
ServiceUart();
void ioConfig(); // sets io HW ports and pins. Only needed at first boot
void ioInit(); //
bool readTrigger();
bool detectConnection() {return (m_rxPin.get()|| m_enabled);}
bool startup();
bool transmit(const char* s, uint16_t length, bool wait = false);
The file drvr.cpp is where I try calling the function. A snippet of what I think is relevant from that file looks like this:
drvr.cpp
#include "EHS5_drv.hpp"
char debug[] = "I got to here!";
transmit(debug,true);
I tried serviceUart.transmit and serviceUart::transmit, but no matter what I try, I get the error code `#20 identifier "transmit" is undefined". I guess I'm misunderstanding the syntax?
transmit()ServiceUart, I would suggest a good C++ book if this is a new concept to you.ServiceUartobject instantiated? And note that you passtruefor thelengthargument (and since you don't have such an overload, this is my guess as to the problem). Please edit your question to include the full and complete build output, copy-pasted as text.