I am getting the following error from g++ ...
./include/WatchTable_class.h:23: error: invalid use of non-static data member `WatchTable::start'
Here is the class header file ...
#ifndef WatchTable_class_h
#define WatchTable_class_h
#include "./watch_class.h"
class WatchTable
{
private:
Watch* start; //<<<<<<<<<<<<<<<<
int tableLength;
public:
WatchTable();
~WatchTable();
...
};
The indicated line is where the problem occurs. I am trying to create a pointer to an object of class Watch named start. I can find nothing on the web about what causes this error, but if I change the line to read...
static Watch* start; //<<<<<<<<<<<<<<<<
the error goes away %-) but then I get a link error...
undefined reference to `WatchTable::start'
I have no idea why the compiler wants start to be a static pointer, or why the linker can not find WatchTable::start after I changed it to static.
Thanks in advance for any help. I have been pouring over my books and the web but I can't get my head around this one.