Apparently the function bool send(unsigned char*, int) is not declared...but I am looking at it in the .h file. Or at least I think so...can someone point out to me what I am missing here?
Code:#ifndef ROBOT_H #define ROBOT_H #include "rs232.h" class Robot { public: Robot(int, int); ~Robot(); int& getPort(); void setPort(int&); int& getBaudRate(); void setBaudRate(int&); SerialConnect& getConnection(); bool send(unsigned char*, int); private: int port; int baudrate; SerialConnect connection; }; #endifCode:#include "Robot.h" Robot::Robot(int portNo, int br) : port(portNo), baudrate(br) { if(connection.OpenComport(port, baudrate)) printf("no worked\n"); else printf("worked\n"); } //END ROBOT() Robot::~Robot() { connection.CloseComport(port); } //END ~ROBOT() SerialConnect& Robot::getConnection() {return connection;} int& Robot::getPort() {return port;} void Robot::setPort(int& p) {port = p;} int& Robot::getBaudRate() {return baudrate;} void Robot::setBaudRate(int& br) {baudrate = br;} bool Robot::send(unsigned char* bytes, int size) { if(connection.SendBuf(port, bytes, size) == -1) return false; else return true; }
Whenever I compile with -
g++ -o go rs232.c Robot.cpp main.cpp
I get the error -
Robot.cpp:24: error: no ‘bool Robot::send(unsigned char*, int)’ member function declared in class ‘Robot’
Is it just me...or is the declaration right there in the .h file? I don't see how its not declared. Can anyone please point out something that is wrong? This has been giving me entirely too much trouble. Thanks for any replies.




Reply With Quote