"writeReg" is a standalone function. It is not a member of the ADCreader class, therefore it cannot call non-static member functions of the ADCreader class without using an instance of that class. The compiler is telling you that there is no standalone function called "pabort()", which is true. If you want to call the pabort() method of ADCreader, you have to do it through an instance of that class:
ADCreader myReader;
myReader.pabort( "Whatever" );
// or
ADCreader * myReader = new ADCreader;
myReader->pabort( "Whatever" );
delete myReader;
ADCreader myReader;
myReader.pabort( "Whatever" );
// or
ADCreader * myReader = new ADCreader;
myReader->pabort( "Whatever" );
delete myReader;
To copy to clipboard, switch view to plain text mode
Probably you don't want to do either of these alternatives, because it is likely you have a global instance of ADCreader that you are using in your program, and that's the one you want to call pabort(). If it isn't visible in the same scope as writeReg(), then you can make it visible by passing it as an argument to writeReg() (preferred) or declaring the global instance as an "extern ADCreader * myGlobalReader;" and ensuring that your global instance is named the same thing and assigned properly.
I think it would be useful to you to learn to walk in C++ before you run while holding a RaspberryPi. Get a C++ book, learn about classes, scoping, and the like, then have at it.
--Edit--
Actually, it looks like you just forgot to make writeReg() a member function of ADCreader, since you have a "readReg" member function already. Still, you need to learn more C++ so you can recognize what it means when your compiler points out these errors to you.
Bookmarks