"dlist_test.cc:16: error: 'testList' was not declared in this scope.
dlist_test.cc:16: error: 'Dlist' was not declared in this scope."
I have been looking at other threads on circular dependences or namespace but I only have one header file, and I'm not using a namespace for dlist.h or dlist.cc. Where am I not declaring this correctly? Is it a Makefile problem? Any help would be appreciated, thank you for your time.
dlist.h:
#ifndef DLIST_H
#define DLIST_H
struct ListNode 
{
  /* define your list node type */
  int val;
  ListNode* next;
  ListNode* prev;
};
class DList
{
  public:
  DList();
  /* implement copy constructor, assignment, destructor if needed */
  void add_to_front(int value);
  void add_to_back(int value);
  int first();
  int last();
  void remove(ListNode* node);
  ListNode* previous(ListNode* node);
  ListNode* next(ListNode* node);
  ListNode* search_value(int value);
  private:
  /* declare your data */
  ListNode* head;
  ListNode* tail;
};
#endif
dlist.cc
#include "dlist.h"
#include <cstddef>
#include <stdlib.h>
class Dlist{
   public:
      Dlist(){
               head = NULL;
               tail = NULL;
      }
      void add_to_front(int value){ 
         struct ListNode* newhead = (struct ListNode*) malloc(sizeof(struct ListNode)); 
         newhead->val  = value; 
         newhead->prev = NULL; 
         newhead->next = head;     
         if(head !=  NULL) 
            head->prev = newhead ;     
         head = newhead; 
      }   
      void add_to_back(int value){
         if (tail == NULL){
            struct ListNode* firstValue = (struct ListNode*)malloc(sizeof(ListNode));
            firstValue->val = value;
            firstValue->prev = NULL;
            firstValue->next = NULL;
            tail = firstValue;
         }else{
            struct ListNode* newtail = (struct ListNode*)malloc(sizeof(ListNode));
            newtail->val = value;
            newtail->next = NULL;
            newtail->prev = tail;
            tail->next = newtail;
            tail = newtail;
         }
      }
      int first(){
         return head->val;
      }
      int last(){
         return tail->val;
      }
      void remove(ListNode* node){
         if (head == NULL || node == NULL){
            return;
         }
         if(head == node){
            head = node->next;
         }
         if (node->next != NULL){
            node->next->prev = node->prev;
         }
         if (node->prev != NULL){
            node->prev->next = node->next;
         }
         free(node);
      }
      ListNode* previous(ListNode* node){
         if(node->prev != NULL){
            return node->prev;
         }
      }
      ListNode* next(ListNode* node){
         if(node->next != NULL){
            return node->next;
         }
      }
      ListNode* search_value(int value){
         while(head->next != NULL){
            if(head->next->val == value){
               return head;
            }else{
               head = head->next;
            }
         }
      }
   private:
      ListNode* head;
      ListNode* tail;
   };
dlist_test.cc
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "dlist.h"
#include <bits/stdc++.h> 
using namespace std; 
int main (int argc, char* argv[])
{
  int N = -1;
  if (argc == 2) {
    N = atoi (argv[1]);
    assert (N > 0);
  } 
  testList = Dlist();
  int i = 0;
  while(i<N){
    testList.add_to_back(i+1);
    i++;
  }
  int randn = rand() % N + 1;// randn in the range 1 to N
  //
  time_t start, end;
  time(&start); 
  ios_base::sync_with_stdio(false); 
  struct ListNode* loc = testList.search_value(randn);
  testList.remove(loc);
  time(&end); 
  double time_taken = double(end - start); 
    cout << "Time taken by program is : " << fixed 
         << time_taken << setprecision(5); 
    cout << " sec " << endl; 
  //
  testList.add_to_front(N);
  return 0;
}
Makefile:
default:
    @echo "=================================================="
    @echo "To build your sorting code, use:"
    @echo "make dlist_test or  make queue_test"
    @echo "=================================================="
# Queue driver
queue_test: queue.o
# Doubly linked list driver
dlist_test: dlist.o dlist_test.o
    g++ -o dlist_test dlist.o dlist_test.o
dlist.o: dlist.cc dlist.h
    g++ -c dlist.cc
dlist_test.o: dlist_test.cc
    g++ -c dlist_test.cc
clean:
    rm -f core *.o *~ queue_test dlist_test
# eof
 
     
    