How do I create the same struct/variables with same functions without interfering with the existing header files at the global declarations segment? The global variables segment (Main.cpp) is as listed below the header code
Take note - I'm not allowed to edit the header file to have noEntry/Explorable (Special case)
HEADER CODE
struct PathFinderResource
{
pthread_t activeThreadArray [MAX_NO_OF_THREADS];
PathFinderParameterInfo * activeThreadParamArray [MAX_NO_OF_THREADS];
VectorOfPointStructType solutionPath;
VectorOfPointStructType discoveredDangerAreas;
//VectorOfPointStructType noEntry;
//VectorOfPointStructType explorable;
int usedThreadNameIndex;
int noOfDeadEndPathsFound;
int noOfBarriersDiscovered;
int noOfDangerAreaDiscovered;
PathFinderResource (void)
{
usedThreadNameIndex = 0;
noOfDeadEndPathsFound = 0;
noOfBarriersDiscovered = 0;
noOfDangerAreaDiscovered = 0;
solutionPath = VectorOfPointStructType ();
discoveredDangerAreas = VectorOfPointStructType ();
}
~PathFinderResource (void)
{
solutionPath.clear ();
discoveredDangerAreas.clear ();
}
};
PathFinderResource globalPathFinderResource;
MAIN.cpp These are my various attempts to solve the following error
Assn3.cpp:311:42: error: ‘struct Assignm3::PathFinderResource’ has no member named ‘noEntry’ globalPathFinderResource.noEntry.push_back (nextPoint); ^ Assn3.cpp: In function ‘VectorOfPointStructType findAlternativePath(VectorOfPointStructType)’: Assn3.cpp:347:35: error: ‘struct Assignm3::PathFinderResource’ has no member named ‘explorable’ if (!globalPathFinderResource.explorable.empty ()) ^ Assn3.cpp:349:43: error: ‘struct Assignm3::PathFinderResource’ has no member named ‘explorable’ for (j = globalPathFinderResource.explorable.rbegin() ; j < globalPathFinderResource.explorable.rend() ; j++)
// Global Variables
const std::string filename = "mazedata.txt";
globalPathFinderResource noEntry = VectoryOfPointStructType();
globalPathFinderResource explorable = VectoryOfPointStructType();
//VectorOfPointStructType noEntry = VectorOfPointStructType ();
//VectorOfPointStructType explorable = VectorOfPointStructType ();
//globalPathFinderResource VectorOfPointStructType noEntry = VectorOfPointStructType();
//globalPathFinderResource VectorOfPointStructType explorable = VectorOfPointStructType();