I have been trying to add a list to tinymudserver. It is a list of an object I have added called tArea, which is in its own area.h file. Also in area.h I have put in:
To my understanding, this is defining the datatype tAreaList as a list of pointers to tArea objects, and defining an iterator for that list of pointers to tArea objects.
To create a global area list, I have added
to globals.h and then added the line:
to define the global area list. To my understanding this should create a global list of areas, yet when I try to use the area list, g++ compiles it fine but I get linker errors:
These errors occur whenever I try to use the area list, but in case it matters I am including both globals.h and area.h and the first line of this code throws the error:
There is probably something blaringly obvious that I am doing wrong here, but I can't see it and I am going nuts trying to figure this out.
typedef std::list <tArea*> tAreaList;
typedef tAreaList::iterator tAreaListIterator;
To my understanding, this is defining the datatype tAreaList as a list of pointers to tArea objects, and defining an iterator for that list of pointers to tArea objects.
To create a global area list, I have added
#include "area.h"
to globals.h and then added the line:
extern tAreaList arealist;
to define the global area list. To my understanding this should create a global list of areas, yet when I try to use the area list, g++ compiles it fine but I get linker errors:
undefined reference to `_arealist'
These errors occur whenever I try to use the area list, but in case it matters I am including both globals.h and area.h and the first line of this code throws the error:
for(tAreaListIterator iter = arealist.begin(); iter != arealist.end(); iter++)
{
(*iter)->LoadArea();
}
There is probably something blaringly obvious that I am doing wrong here, but I can't see it and I am going nuts trying to figure this out.