Hello everyone,

I am making a program which acts like a library system. There are two classes: Book and List. The List class contains all the linked list information;

struct ListNode
{
  ListItemType item;
  ListNode *Next;
};

Now, my problem is in the Book class file (Book.cc). I have the List.h file included in Book.cc but i am unable to use any of the Linked List commands in Book.cc. Such as;

ListNode cur = new ListNode;
cur = head;
cur = cur->next;

I get the error;

Error 419: "Book.cc", line 40 # 'ListNode' is used as a type, but has not been defined as a type.

I've been beating my head against the wall trying to find a way to use the List class types in my Book class. I just cant think of anything.

>The List class contains all the linked list information
This sounds like ListNode is a nested class. Most likely the problem is you're not properly qualifying the type:

List::ListNode cur = new List::ListNode;
cur = head;
cur = cur->next;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.