For an assignment, I'm to create a custom singly-linked list using a class previously created as the type.
When creating the node for the list in any methods in the custom list class, however, I get that my node type is unresolved. I have included the correct header file, and am in the correct name space. I am out of ideas as to why this is happening. Below is an example:
#include "RiderList.h"
#include "RiderNode.h"
using namespace cse274;
void RiderList::addToHead(Rider *el){
head = new RiderNode(el,head); //this is where RiderNode is unresolved
if (tail == NULL)
tail = head;
}
as requested...here are the two headers and the exact error:
#ifndef RIDERLIST_H_
#define RIDERLIST_H_
#include "RiderNode.h"
namespace cse274{
class RiderList{
public:
RiderList() {
head = tail = 0;
}
~RiderList();
bool isEmpty() {
return head == 0;
}
void addToHead(Rider *ride);
void addToTail(Rider *ride);
Rider *deleteFromHead(); // delete the head and return its info;
Rider *deleteFromTail(); // delete the tail and return its info;
private:
RiderList *head, *tail;
};
}
#endif /* RIDERLIST_H_ */
#ifndef RIDERNODE_H_
#define RIDERNODE_H_
#include "Rider.h"
namespace cse274{
class RiderNode{
public:
Rider *info;
RiderNode *next;
RiderNode(Rider *el, RiderNode *ptr) {
info = el;
next = ptr;
}
};
}
#endif /* RIDERNODE_H_ */
exact error message:
Type 'RiderNode' could not be resolved: name resolution problem found by the indexer
Any clues as to why this would occur? Thanks!